|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - 'v*' |
| 5 | + |
| 6 | +name: tag |
| 7 | +jobs: |
| 8 | + build_and_test: |
| 9 | + name: ClickMuteJack |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + # https://stackoverflow.com/a/58178121 |
| 14 | + - name: Set release information |
| 15 | + id: vars |
| 16 | + run: echo ::set-output name=git_describe::"$(git describe --tags)" |
| 17 | + - name: Cancel if no tag |
| 18 | + if: ${{ steps.vars.outputs.git_describe == '' }} |
| 19 | + run: false |
| 20 | + - name: Build started notification |
| 21 | + |
| 22 | + with: |
| 23 | + room_id: ${{ secrets.MATRIX_ROOM_ID }} |
| 24 | + access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} |
| 25 | + message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build started. [Progress.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})" |
| 26 | + server: ${{ secrets.MATRIX_SERVER }} |
| 27 | + - name: Install build deps |
| 28 | + run: sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev |
| 29 | + - uses: actions-rs/toolchain@v1 |
| 30 | + with: |
| 31 | + toolchain: nightly |
| 32 | + - name: Set annotated tag info information |
| 33 | + id: vars2 |
| 34 | + run: echo ::set-output name=git_message::"$(git tag -n999 -l $(git describe --tags))" |
| 35 | + - name: build |
| 36 | + env: |
| 37 | + GIT_DESCRIBE: ${{ steps.vars.outputs.git_describe }} |
| 38 | + run: 'cargo +nightly -Z unstable-options --config rustc-link-search=\"/usr/lib/x86_64-linux-gnu\" build --release' |
| 39 | + - run: strip target/release/click_mute |
| 40 | + - uses: actions/upload-artifact@v2 |
| 41 | + with: |
| 42 | + name: click-mute |
| 43 | + path: | |
| 44 | + target/release/click_mute |
| 45 | + # https://github.com/actions/create-release |
| 46 | + - name: Create Release |
| 47 | + id: create_release |
| 48 | + uses: actions/create-release@v1 |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 51 | + with: |
| 52 | + tag_name: ${{ github.ref }} |
| 53 | + release_name: Release ${{ github.ref }} |
| 54 | + body: ${{ steps.vars2.outputs.git_message}} |
| 55 | + draft: false |
| 56 | + prerelease: false |
| 57 | + # https://github.com/actions/upload-release-asset |
| 58 | + - name: Upload Release Asset |
| 59 | + id: upload_release_asset |
| 60 | + uses: actions/upload-release-asset@v1 |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + with: |
| 64 | + # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 65 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 66 | + asset_path: ./target/release/click_mute |
| 67 | + asset_name: click-mute-${{ steps.vars.outputs.git_describe }}-linux-x86_64.bin |
| 68 | + asset_content_type: application/octet-stream |
| 69 | + - name: Build succeeded notification |
| 70 | + if: ${{ success() }} |
| 71 | + |
| 72 | + with: |
| 73 | + room_id: ${{ secrets.MATRIX_ROOM_ID }} |
| 74 | + access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} |
| 75 | + message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build complete. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})" |
| 76 | + server: ${{ secrets.MATRIX_SERVER }} |
| 77 | + - name: Build failed notification |
| 78 | + if: ${{ !success() }} |
| 79 | + |
| 80 | + with: |
| 81 | + room_id: ${{ secrets.MATRIX_ROOM_ID }} |
| 82 | + access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} |
| 83 | + message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build failed. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})" |
| 84 | + server: ${{ secrets.MATRIX_SERVER }} |
0 commit comments