|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + setup: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + uploadurl: ${{ steps.create_release.outputs.upload_url }} |
| 13 | + steps: |
| 14 | + - name: Create Release |
| 15 | + id: create_release |
| 16 | + uses: actions/create-release@latest |
| 17 | + env: |
| 18 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 19 | + with: |
| 20 | + tag_name: ${{ github.ref }} |
| 21 | + release_name: ${{ github.ref }} |
| 22 | + body: "" |
| 23 | + draft: true |
| 24 | + prerelease: false |
| 25 | + |
| 26 | + # Build for Windows |
| 27 | + windows: |
| 28 | + runs-on: windows-latest |
| 29 | + needs: [setup] |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + - name: Build |
| 33 | + run: cargo build --release |
| 34 | + - name: Upload Artifact to Job |
| 35 | + uses: actions/upload-artifact@v1 |
| 36 | + with: |
| 37 | + name: configure.exe |
| 38 | + path: target/release/configure.exe |
| 39 | + - name: Package |
| 40 | + id: package-windows-release-asset |
| 41 | + run: Compress-Archive target/release/configure.exe configure-windows.zip |
| 42 | + - name: Attach Artifact to Release |
| 43 | + id: upload-windows-release-asset |
| 44 | + uses: actions/upload-release-asset@v1 |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + with: |
| 48 | + upload_url: ${{needs.setup.outputs.uploadurl}} |
| 49 | + asset_path: configure-windows.zip |
| 50 | + asset_name: configure-windows.zip |
| 51 | + asset_content_type: application/zip |
| 52 | + # Build for Mac |
| 53 | + mac: |
| 54 | + runs-on: macos-latest |
| 55 | + needs: [setup] |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + - name: Build |
| 59 | + run: cargo build --release |
| 60 | + - name: Upload Artifact to Job |
| 61 | + uses: actions/upload-artifact@v1 |
| 62 | + with: |
| 63 | + name: configure-macos |
| 64 | + path: target/release/configure |
| 65 | + - name: Package |
| 66 | + id: package-mac-release-asset |
| 67 | + run: | |
| 68 | + cd target/release |
| 69 | + zip configure-macos.zip configure |
| 70 | + mv configure-macos.zip ../../ |
| 71 | + cd - |
| 72 | + - name: Attach Artifact to Release |
| 73 | + id: upload-mac-release-asset |
| 74 | + uses: actions/upload-release-asset@v1 |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + with: |
| 78 | + upload_url: ${{needs.setup.outputs.uploadurl}} |
| 79 | + asset_path: configure-macos.zip |
| 80 | + asset_name: configure-macos.zip |
| 81 | + asset_content_type: application/zip |
| 82 | + # Build for Linux |
| 83 | + linux: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + needs: [setup] |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v2 |
| 88 | + - name: Build |
| 89 | + run: cargo build --release |
| 90 | + - name: Upload Artifact to Job |
| 91 | + uses: actions/upload-artifact@v1 |
| 92 | + with: |
| 93 | + name: configure-linux |
| 94 | + path: target/release/configure |
| 95 | + - name: Package |
| 96 | + id: package-linux-release-asset |
| 97 | + run: | |
| 98 | + cd target/release |
| 99 | + zip configure-linux.zip configure |
| 100 | + mv configure-linux.zip ../../ |
| 101 | + cd - |
| 102 | + - name: Attach Artifact to Release |
| 103 | + id: upload-linux-release-asset |
| 104 | + uses: actions/upload-release-asset@v1 |
| 105 | + env: |
| 106 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + with: |
| 108 | + upload_url: ${{needs.setup.outputs.uploadurl}} |
| 109 | + asset_path: configure-linux.zip |
| 110 | + asset_name: configure-linux.zip |
| 111 | + asset_content_type: application/zip |
0 commit comments