|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + macos: |
| 10 | + runs-on: macos-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + with: |
| 15 | + submodules: recursive |
| 16 | + - name: Install dependencies |
| 17 | + run: | |
| 18 | + export HOMEBREW_NO_AUTO_UPDATE=true |
| 19 | + brew install create-dmg |
| 20 | + cargo install cargo-bundle |
| 21 | + - name: Install ARM target |
| 22 | + run: rustup update && rustup target add aarch64-apple-darwin && rustup target add x86_64-apple-darwin |
| 23 | + - name: Bundle X64 |
| 24 | + run: cargo bundle --release --target=x86_64-apple-darwin |
| 25 | + - name: Bundle ARM |
| 26 | + run: cargo bundle --release --target=aarch64-apple-darwin |
| 27 | + - name: Make DMG |
| 28 | + uses: nick-fields/retry@v3 |
| 29 | + with: |
| 30 | + timeout_minutes: 15 |
| 31 | + max_attempts: 5 |
| 32 | + warning_on_retry: false |
| 33 | + retry_on: error |
| 34 | + command: | |
| 35 | + cd target/x86_64-apple-darwin/release/bundle/osx/ |
| 36 | + create-dmg --volname "Tank Installer" \ |
| 37 | + --volicon "Tank.app/Contents/Resources/Tank.icns" \ |
| 38 | + --window-pos 200 120 \ |
| 39 | + --window-size 800 400 \ |
| 40 | + --icon-size 100 \ |
| 41 | + --icon "Tank.app" 200 190 \ |
| 42 | + --hide-extension "Tank.app" \ |
| 43 | + --app-drop-link 600 185 \ |
| 44 | + "Tank-Installer.dmg" \ |
| 45 | + "Tank.app" |
| 46 | +
|
| 47 | + cd - |
| 48 | + cd target/aarch64-apple-darwin/release/bundle/osx/ |
| 49 | + create-dmg --volname "Tank Installer" \ |
| 50 | + --volicon "Tank.app/Contents/Resources/Tank.icns" \ |
| 51 | + --window-pos 200 120 \ |
| 52 | + --window-size 800 400 \ |
| 53 | + --icon-size 100 \ |
| 54 | + --icon "Tank.app" 200 190 \ |
| 55 | + --hide-extension "Tank.app" \ |
| 56 | + --app-drop-link 600 185 \ |
| 57 | + "Tank-Installer.dmg" \ |
| 58 | + "Tank.app" |
| 59 | + - name: Get Tag Name |
| 60 | + run: | |
| 61 | + echo "TAG_NAME=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV |
| 62 | + - name: Change name |
| 63 | + run: | |
| 64 | + mv target/x86_64-apple-darwin/release/bundle/osx/Tank-Installer.dmg "target/Tank-${{ env.TAG_NAME }}-x64.dmg" |
| 65 | + mv target/aarch64-apple-darwin/release/bundle/osx/Tank-Installer.dmg "target/Tank-${{ env.TAG_NAME }}-aarch64.dmg" |
| 66 | + - name: Upload |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: artifact-macos |
| 70 | + path: | |
| 71 | + target/Tank-${{ env.TAG_NAME }}-x64.dmg |
| 72 | + target/Tank-${{ env.TAG_NAME }}-aarch64.dmg |
| 73 | +
|
| 74 | + windows: |
| 75 | + runs-on: windows-latest |
| 76 | + defaults: |
| 77 | + run: |
| 78 | + shell: bash |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + submodules: recursive |
| 84 | + - name: Install dependencies |
| 85 | + run: dotnet tool install --global wix --version 4.0.5 |
| 86 | + - name: Get Tag Name |
| 87 | + run: | |
| 88 | + echo "TAG_NAME=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV |
| 89 | + - name: Create msi installer |
| 90 | + run: | |
| 91 | + cargo build --release |
| 92 | + wix extension add WixToolset.UI.wixext/4.0.5 WixToolset.Util.wixext/4.0.5 |
| 93 | + wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext \ |
| 94 | + -out "target/Tank-${{ env.TAG_NAME }}-installer-x64.msi" "wix/tank.wxs" |
| 95 | + - name: Upload |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: artifact-windows |
| 99 | + path: target/Tank-${{ env.TAG_NAME }}-installer-x64.msi |
| 100 | + |
| 101 | + linux: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v4 |
| 106 | + with: |
| 107 | + submodules: recursive |
| 108 | + - name: Install dependencies |
| 109 | + run: | |
| 110 | + sudo apt-get install libwebkit2gtk-4.1-dev -y |
| 111 | + cargo install cargo-bundle |
| 112 | + - name: Bundle |
| 113 | + run: cargo bundle --release --target=x86_64-unknown-linux-gnu --format=deb |
| 114 | + - name: Get Tag Name |
| 115 | + run: | |
| 116 | + echo "TAG_NAME=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV |
| 117 | + - name: Upload |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: artifact-linux |
| 121 | + path: | |
| 122 | + target/x86_64-unknown-linux-gnu/release/bundle/deb/tank_${{ env.TAG_NAME }}_amd64.deb |
| 123 | + release: |
| 124 | + runs-on: ubuntu-latest |
| 125 | + needs: [macos, windows, linux] |
| 126 | + |
| 127 | + steps: |
| 128 | + - name: Download artifacts |
| 129 | + uses: actions/download-artifact@v4 |
| 130 | + with: |
| 131 | + path: artifacts |
| 132 | + pattern: artifact-* |
| 133 | + merge-multiple: true |
| 134 | + - name: Release |
| 135 | + uses: ncipollo/release-action@v1 |
| 136 | + with: |
| 137 | + allowUpdates: true |
| 138 | + draft: true |
| 139 | + artifacts: "artifacts/*.dmg,artifacts/*.msi,artifacts/*.deb" |
0 commit comments