From 8d86907120b5d7e7340e28233986a3f2b5cb5442 Mon Sep 17 00:00:00 2001 From: Tom Hensel <80815+gretel@users.noreply.github.com> Date: Fri, 28 May 2021 10:26:38 +0200 Subject: [PATCH] compose and use "dynamic" names for the assets to be released; sync "actions.yml" with "nightly.yaml"; formatting (#100) --- .github/workflows/actions.yml | 31 ++++++++---------------- .github/workflows/nightly.yml | 44 +++++++++++++++-------------------- 2 files changed, 29 insertions(+), 46 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0130706e8..2b81de990 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -4,27 +4,14 @@ on: push: branches: - '2.4' + - 'nightly_filenames' pull_request: branches: - '2.4' jobs: - metadata: - name: Store metadata - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Package common files - uses: 'actions/upload-artifact@v2' - with: - name: edgetx-firmware-nightly - path: | - fw.json - LICENSE - README.md - test: + name: Run tests runs-on: ubuntu-latest strategy: matrix: @@ -52,9 +39,7 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - - # - name: Fetch tags - # run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + # fetch-depth: 0 # https://github.com/actions/checkout#Fetch-all-history-for-all-tags-and-branches - name: Test ${{ matrix.target }} env: @@ -71,12 +56,16 @@ jobs: ./tools/build-gh.sh - name: Compose release filename - run: echo "artifact_name=edgetx-firmware-${GITHUB_REF}" >> $GITHUB_ENV + # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions + run: echo "artifact_name=edgetx-firmware-${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Package firmware ${{ matrix.target }} uses: 'actions/upload-artifact@v2' with: - name: "$${ env.artifact_name }}" - path: "${{ github.workspace }}/*.bin" + name: "${{ env.artifact_name }}" + path: | + fw.json + LICENSE + *.bin retention-days: 15 if-no-files-found: error diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 43b79f9d8..e3c663190 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,31 +1,20 @@ --- name: Build and deploy nightly release on: - # push: - # branches: [ nightly_filenames ] + push: + branches: + - 'nightly_filenames' schedule: - cron: '0 2 * * *' # run at 2 AM UTC -jobs: - metadata: - name: Store metadata - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Package common files - uses: 'actions/upload-artifact@v2' - with: - name: edgetx-firmware-nightly - path: | - fw.json - LICENSE - README.md +concurrency: + group: 'nightly' + cancel-in-progress: true +jobs: build: name: Build firmware runs-on: ubuntu-latest - needs: metadata strategy: matrix: target: @@ -62,7 +51,10 @@ jobs: uses: 'actions/upload-artifact@v2' with: name: edgetx-firmware-nightly - path: "${{ github.workspace }}/*.bin" + path: | + fw.json + LICENSE + *.bin retention-days: 15 if-no-files-found: error @@ -78,16 +70,18 @@ jobs: path: edgetx-firmware-nightly - name: Compose release filename - run: echo "release_filename=edgetx-firmware-nightly-${GITHUB_SHA::8}.tgz" >> $GITHUB_ENV + run: echo "release_filename=edgetx-firmware-nightly-${GITHUB_SHA::8}.zip" >> $GITHUB_ENV - - name: Package files - run: tar -cvzf ${{ env.release_filename }} ./edgetx-firmware-nightly + - name: Zip release file + uses: montudor/action-zip@v1 + with: + args: zip -qq -r ${{ env.release_filename }} ./edgetx-firmware-nightly - name: Deploy release - uses: "marvinpinto/action-automatic-releases@latest" + uses: marvinpinto/action-automatic-releases@latest with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "nightly" + automatic_release_tag: 'nightly' prerelease: true files: | - ${{ env.release_filename }} + *.zip