From e4e42cd081a8ff496701a8941f84ca72221f9ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= Date: Wed, 4 Jan 2023 11:11:39 +0200 Subject: [PATCH 1/2] ci: use failure() instead of !success(); this maybe handles skipping jobs? We don't want a failure notification when we skipped the job to begin with. --- .github/workflows/build.yaml | 2 +- .github/workflows/tag.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 85bca63..72be343 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -79,7 +79,7 @@ jobs: notify_end_failed: runs-on: ubuntu-latest needs: [notify_start, build] - if: ${{ !success() }} + if: ${{ failure() }} steps: - name: Build failed notification uses: s3krit/matrix-message-action@v0.0.3 diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 9e55741..0e1fb93 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -160,7 +160,7 @@ jobs: notify_end_failed: runs-on: ubuntu-latest needs: [start, unix, windows] - if: ${{ !success() }} + if: ${{ failure() }} steps: - name: Build failed notification uses: s3krit/matrix-message-action@v0.0.3 From f659bef905b369411d6fac7fc841880cbe292f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= Date: Wed, 4 Jan 2023 11:56:18 +0200 Subject: [PATCH 2/2] ci: fix asset uploading --- .github/workflows/tag.yaml | 70 +++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index 0e1fb93..65ec551 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -71,24 +71,12 @@ jobs: run: 'cargo build --release --locked' - run: strip target/release/mxrxtx if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} - - uses: actions/upload-artifact@v2 - with: - name: mxrxtx - path: | - target/release/mxrxtx - Cargo.lock + - run: "gzip -9 < target/release/mxrxtx > mxrxtx.gz" if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} - # https://github.com/actions/upload-release-asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/upload-artifact@v2 with: - # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - upload_url: ${{ needs.start.outputs.upload_url }} - asset_path: ./target/release/mxrxtx - asset_name: mxrxtx-${{ needs.start.outputs.git_describe }}-${{ runner.os }}.bin - asset_content_type: application/octet-stream + path: mxrxtx.gz + name: mxrxtx-${{ runner.os }}.gz if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} windows: name: mxrxtx @@ -122,26 +110,38 @@ jobs: env: GIT_DESCRIBE: ${{ needs.start.outputs.git_describe }} run: 'cargo build --release' + - run: 'tar.exe -a -c -f mxrxtx.zip -C target/release mxrxtx.exe' - uses: actions/upload-artifact@v2 with: - name: mxrxtx - path: | - target/release/mxrxtx.exe - Cargo.lock - # https://github.com/actions/upload-release-asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + path: mxrxtx.zip + name: mxrxtx-${{ runner.os }}.zip + publish: + runs-on: ubuntu-latest + needs: [start, unix, windows] + if: ${{ success() }} + steps: + - uses: actions/checkout@v2 with: - # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - upload_url: ${{ needs.start.outputs.upload_url }} - asset_path: ./target/release/mxrxtx.exe - asset_name: mxrxtx-${{ needs.start.outputs.git_describe }}-${{ runner.os }}.exe - asset_content_type: application/octet-stream + submodules: false + - uses: actions/download-artifact@v3 + with: + path: . + - run: 'ls -la' + - name: Publish release + uses: eloquent/github-release-action@v3 + with: + prerelease: false + # Note the "|" character: this is a multi-line string + assets: | + - path: mxrxtx-Windows.zip + name: mxrxtx-${{ needs.start.outputs.git_describe }}-Windows.zip + label: Windows binary + - path: mxrxtx-Linux.gz + name: mxrxtx-${{ needs.start.outputs.git_describe }}-Linux.gz + label: Linux binary notify_end_success: runs-on: ubuntu-latest - needs: [start, unix, windows] + needs: [start, publish] if: ${{ success() }} steps: - name: Build succeeded notification @@ -151,15 +151,9 @@ jobs: access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} message: "mxrxtx release ${{ needs.start.outputs.git_describe }} build complete. [Logs.](https://github.com/eras/mxrxtx/actions/runs/${{github.run_id}})" server: ${{ secrets.MATRIX_SERVER }} - - name: Publish release - uses: eloquent/github-release-action@v3 - with: - assets: | - - "mxrxtx-${{ needs.start.outputs.git_describe }}-Windows.exe": "mxrxtx-Windows.exe" - - "mxrxtx-${{ needs.start.outputs.git_describe }}-Linux.bin": "mxrxtx-Linux.bin" notify_end_failed: runs-on: ubuntu-latest - needs: [start, unix, windows] + needs: [start, publish] if: ${{ failure() }} steps: - name: Build failed notification