|
| 1 | +name: Release Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-linux: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout source |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - name: Build release (Linux) |
| 15 | + uses: actions-rs/cargo@v1 |
| 16 | + with: |
| 17 | + command: build |
| 18 | + args: --release |
| 19 | + - run: strip target/release/gptman |
| 20 | + - uses: actions/upload-artifact@v2 |
| 21 | + with: |
| 22 | + name: binary-linux |
| 23 | + path: target/release/gptman |
| 24 | + |
| 25 | + build-windows: |
| 26 | + runs-on: windows-latest |
| 27 | + steps: |
| 28 | + - name: Checkout source |
| 29 | + uses: actions/checkout@v2 |
| 30 | + - name: Build release (Windows) |
| 31 | + uses: actions-rs/cargo@v1 |
| 32 | + with: |
| 33 | + command: build |
| 34 | + args: --release --target=x86_64-pc-windows-msvc |
| 35 | + - uses: actions/upload-artifact@v2 |
| 36 | + with: |
| 37 | + name: binary-windows |
| 38 | + path: target/x86_64-pc-windows-msvc/release/gptman.exe |
| 39 | + |
| 40 | + build-osx-x86: |
| 41 | + runs-on: macos-latest |
| 42 | + steps: |
| 43 | + - name: Checkout source |
| 44 | + uses: actions/checkout@v2 |
| 45 | + - name: Build release (OSX) |
| 46 | + uses: actions-rs/cargo@v1 |
| 47 | + with: |
| 48 | + command: build |
| 49 | + args: --release |
| 50 | + - uses: actions/upload-artifact@v2 |
| 51 | + with: |
| 52 | + name: binary-osx |
| 53 | + path: target/release/gptman |
| 54 | + |
| 55 | + release: |
| 56 | + needs: [build-linux, build-windows, build-osx-x86] |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - name: Get the version |
| 60 | + id: get_version |
| 61 | + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} |
| 62 | + - uses: actions/download-artifact@v2 |
| 63 | + with: |
| 64 | + name: binary-linux |
| 65 | + path: binary-linux |
| 66 | + - uses: actions/download-artifact@v2 |
| 67 | + with: |
| 68 | + name: binary-windows |
| 69 | + path: binary-windows |
| 70 | + - uses: actions/download-artifact@v2 |
| 71 | + with: |
| 72 | + name: binary-osx |
| 73 | + path: binary-osx |
| 74 | + - name: Create Release |
| 75 | + id: create_release |
| 76 | + uses: actions/create-release@v1 |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + with: |
| 80 | + tag_name: ${{ github.ref }} |
| 81 | + release_name: Release ${{ github.ref }} |
| 82 | + body: gptman release ${{ steps.get_version.outputs.VERSION }} |
| 83 | + draft: false |
| 84 | + prerelease: false |
| 85 | + - name: Upload Release Asset Linux |
| 86 | + uses: actions/upload-release-asset@v1 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + with: |
| 90 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 91 | + asset_path: binary-linux/gptman |
| 92 | + asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-linux-x86_64 |
| 93 | + asset_content_type: application/x-pie-executable |
| 94 | + - name: Upload Release Asset Windows |
| 95 | + uses: actions/upload-release-asset@v1 |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + with: |
| 99 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 100 | + asset_path: binary-windows/gptman.exe |
| 101 | + asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-win-x86_64.exe |
| 102 | + asset_content_type: application/x-dosexec |
| 103 | + - name: Upload Release Asset OSX |
| 104 | + uses: actions/upload-release-asset@v1 |
| 105 | + env: |
| 106 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + with: |
| 108 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 109 | + asset_path: binary-osx/gptman |
| 110 | + asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-osx-x86_64 |
| 111 | + asset_content_type: application/x-mach-binary |
0 commit comments