|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - created |
| 7 | + |
| 8 | +jobs: |
| 9 | + compile: |
| 10 | + name: Compile |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - name: linux |
| 16 | + os: ubuntu-latest |
| 17 | + path: target/release/script-runner |
| 18 | + asset_name: script-runner-x86_64-linux-${{ github.event.release.tag_name }} |
| 19 | + shasum_cmd: sha256sum |
| 20 | + - name: macos |
| 21 | + os: macos-latest |
| 22 | + path: target/release/script-runner |
| 23 | + asset_name: script-runner-x86_64-macos-${{ github.event.release.tag_name }} |
| 24 | + shasum_cmd: shasum -a 256 |
| 25 | + - name: windows |
| 26 | + os: windows-latest |
| 27 | + path: target\release\script-runner.exe |
| 28 | + asset_name: script-runner-x86_64-windows-${{ github.event.release.tag_name }} |
| 29 | + shasum_cmd: sha256sum |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v1 |
| 33 | + |
| 34 | + - name: Install Rust |
| 35 | + uses: actions-rs/toolchain@v1 |
| 36 | + with: |
| 37 | + profile: default |
| 38 | + toolchain: 1.59.0 |
| 39 | + default: true |
| 40 | + |
| 41 | + - name: Build ${{ matrix.os }} |
| 42 | + run: cargo build --release --package script-runner |
| 43 | + |
| 44 | + - name: Archive assets |
| 45 | + run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz |
| 46 | + |
| 47 | + - name: Upload assets to artifacts |
| 48 | + uses: actions/upload-artifact@v2 |
| 49 | + with: |
| 50 | + name: ${{ matrix.asset_name }}.gz |
| 51 | + path: ${{ matrix.asset_name }}.gz |
| 52 | + |
| 53 | + - name: Upload assets to release |
| 54 | + uses: actions/upload-release-asset@v1 |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + with: |
| 58 | + upload_url: ${{ github.event.release.upload_url }} |
| 59 | + asset_path: ./${{ matrix.asset_name }}.gz |
| 60 | + asset_name: ${{ matrix.asset_name }}.gz |
| 61 | + asset_content_type: application/gzip |
| 62 | + |
| 63 | + - name: Generate asset hash |
| 64 | + run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256 |
| 65 | + |
| 66 | + - name: Upload asset hash to artifacts |
| 67 | + uses: actions/upload-artifact@v2 |
| 68 | + with: |
| 69 | + name: ${{ matrix.asset_name }}.gz.sha256 |
| 70 | + path: ${{ matrix.asset_name }}.gz.sha256 |
| 71 | + |
| 72 | + - name: Upload asset hash to release |
| 73 | + uses: actions/upload-release-asset@v1 |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + with: |
| 77 | + upload_url: ${{ github.event.release.upload_url }} |
| 78 | + asset_path: ./${{ matrix.asset_name }}.gz.sha256 |
| 79 | + asset_name: ${{ matrix.asset_name }}.gz.sha256 |
| 80 | + asset_content_type: plain/text |
0 commit comments