mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-27 00:09:36 -05:00
8e2442f196
* added fresh build of hackrf firmware to firmware zip * refactoring * refactoring
139 lines
6.4 KiB
YAML
139 lines
6.4 KiB
YAML
name: Nightly Release
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
check_date:
|
|
runs-on: ubuntu-latest
|
|
name: Check latest commit
|
|
outputs:
|
|
should_run: ${{ steps.should_run.outputs.should_run }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: print latest_commit
|
|
run: echo ${{ github.sha }}
|
|
|
|
- name: check latest commit is less than a day
|
|
id: should_run
|
|
continue-on-error: true
|
|
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT
|
|
build:
|
|
needs: check_date
|
|
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
|
- name: Get version date
|
|
id: version_date
|
|
run: echo "date=n_$(date +'%y%m%d')" >> $GITHUB_OUTPUT
|
|
- name: Checkout
|
|
uses: actions/checkout@master
|
|
with:
|
|
fetch-depth: 0
|
|
#ref: next
|
|
# The branch, tag or SHA to checkout. When checking out the repository that
|
|
# triggered a workflow, this defaults to the reference or SHA for that event.
|
|
# Otherwise, uses the default branch.
|
|
# https://github.com/actions/checkout
|
|
# So scheduled runs will use the default branch (next) but its now possible to trigger a workflow from another branch
|
|
submodules: true
|
|
- name: Git Sumbodule Update
|
|
run: |
|
|
git submodule update --init --recursive
|
|
- name: Build the Docker image
|
|
run: docker build -t portapack-dev -f dockerfile-nogit . --tag my-image-name:$(date +%s)
|
|
- name: Make build folder
|
|
run: mkdir ${{ github.workspace }}/build
|
|
- name: Run the Docker image
|
|
run: docker run -e VERSION_STRING=${{ steps.version_date.outputs.date }} -i -v ${{ github.workspace }}:/havoc portapack-dev
|
|
- name: Create Small SD Card ZIP - No World Map
|
|
run: |
|
|
mkdir -p sdcard/FIRMWARE && cp build/firmware/portapack-mayhem-firmware.bin sdcard/FIRMWARE/portapack-mayhem_${{ steps.version_date.outputs.date }}.bin && cp build/firmware/portapack-mayhem_OCI.ppfw.tar sdcard/FIRMWARE/mayhem_nightly_${{ steps.version_date.outputs.date }}_OCI.ppfw.tar && mkdir -p sdcard/APPS && cp build/firmware/application/*.ppma sdcard/APPS && cp build/firmware/standalone/*/*.ppmp sdcard/APPS && cd sdcard && zip -r ../sdcard-no-map.zip . && cd ..
|
|
- name: Download world map
|
|
run: |
|
|
wget https://github.com/portapack-mayhem/mayhem-firmware/releases/download/world_map/world_map.zip
|
|
- name: Unzip world map
|
|
run: |
|
|
unzip world_map.zip -d sdcard/ADSB
|
|
- name: Prepare Firmware ZIP
|
|
run: |
|
|
cp build/hackrf/firmware/hackrf_usb/hackrf_usb.dfu flashing/utils/hackrf_one_usb.dfu && cp build/hackrf/firmware/hackrf_usb/hackrf_usb.bin flashing/utils/hackrf_one_usb.bin
|
|
- name: Create Firmware ZIP
|
|
run: |
|
|
zip -j firmware.zip build/firmware/portapack-mayhem-firmware.bin && cd flashing && zip -r ../firmware.zip *
|
|
- name: Create SD Card ZIP
|
|
run: |
|
|
mkdir -p sdcard/FIRMWARE && cp build/firmware/portapack-mayhem-firmware.bin sdcard/FIRMWARE/portapack-mayhem_${{ steps.version_date.outputs.date }}.bin && cp build/firmware/portapack-mayhem_OCI.ppfw.tar sdcard/FIRMWARE/mayhem_nightly_${{ steps.version_date.outputs.date }}_OCI.ppfw.tar && mkdir -p sdcard/APPS && cp build/firmware/application/*.ppma sdcard/APPS && cp build/firmware/standalone/*/*.ppmp sdcard/APPS && cd sdcard && zip -r ../sdcard.zip . && cd ..
|
|
- name: Create changelog
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
{
|
|
echo 'content<<EOF'
|
|
python3 .github/workflows/changelog.py
|
|
echo EOF
|
|
} >> "$GITHUB_OUTPUT"
|
|
id: changelog
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: nightly-tag-${{ steps.date.outputs.date }}
|
|
release_name: Nightly Release - ${{ steps.date.outputs.date }}
|
|
body: |
|
|
**Nightly release - ${{ steps.date.outputs.date }}**
|
|
This build is the latest and greatest, although may not be the most stable as this is a nightly release.
|
|
## Release notes
|
|
### Revision (${{ steps.version_date.outputs.date }}):
|
|
${{ steps.changelog.outputs.content }}
|
|
draft: false
|
|
prerelease: true
|
|
- name: Upload Firmware TAR Asset
|
|
id: upload-firmware-tar-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: build/firmware/portapack-mayhem_OCI.ppfw.tar
|
|
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_OCI.ppfw.tar
|
|
asset_content_type: application/x-tar
|
|
- name: Upload Firmware Asset
|
|
id: upload-firmware-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./firmware.zip
|
|
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_FIRMWARE.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload SD Card Assets
|
|
id: upload-sd-card-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./sdcard.zip
|
|
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_COPY_TO_SDCARD.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload SD Card Assets - No Map
|
|
id: upload-sd-card-asset-no-map
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./sdcard-no-map.zip
|
|
asset_name: mayhem_nightly_${{ steps.version_date.outputs.date }}_COPY_TO_SDCARD-no-world-map.zip
|
|
asset_content_type: application/zip
|