|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +permissions: read-all |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_INCREMENTAL: 0 |
| 11 | + |
| 12 | +jobs: |
| 13 | + publish-web: |
| 14 | + name: build-release |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + build: [linux-musl, macos-x86_64, macos-aarch64, win-msvc] |
| 21 | + include: |
| 22 | + - build: linux-musl |
| 23 | + os: ubuntu-20.04 |
| 24 | + target: x86_64-unknown-linux-musl |
| 25 | + - build: macos-x86_64 |
| 26 | + os: macos-11 |
| 27 | + target: x86_64-apple-darwin |
| 28 | + - build: macos-aarch64 |
| 29 | + os: macos-14 |
| 30 | + target: aarch64-apple-darwin |
| 31 | + - build: win-msvc |
| 32 | + os: windows-2022 |
| 33 | + target: x86_64-pc-windows-msvc |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + steps: |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 38 | + # - name: Install packages (Ubuntu) |
| 39 | + # if: matrix.os == 'ubuntu-20.04' |
| 40 | + # run: | |
| 41 | + # sudo apt-get update |
| 42 | + # sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools |
| 43 | + - name: Install Rust |
| 44 | + uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 |
| 45 | + with: |
| 46 | + toolchain: stable |
| 47 | + target: ${{ matrix.target }} |
| 48 | + - name: Build release binary |
| 49 | + run: cargo build --target ${{ matrix.target }} --verbose --release -p diffedit3-web |
| 50 | + - name: Build archive |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + # TODO: Create a third action to combine both in one archive |
| 54 | + outdir="target/${{ matrix.target }}/release" |
| 55 | + name="diffedit3-web-${{ github.event.release.tag_name }}-${{ matrix.target }}" |
| 56 | + cd "$outdir" |
| 57 | + ls # Debug |
| 58 | + if [ "${{ matrix.os }}" = "windows-2022" ]; then |
| 59 | + 7z a "../../../$name.zip" diffedit3-web.exe |
| 60 | + echo "ASSET=$name.zip" >> $GITHUB_ENV |
| 61 | + else |
| 62 | + tar czf "../../../$name.tar.gz" diffedit3-web |
| 63 | + echo "ASSET=$name.tar.gz" >> $GITHUB_ENV |
| 64 | + fi |
| 65 | + - name: Upload release archive |
| 66 | + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + with: |
| 70 | + upload_url: ${{ github.event.release.upload_url }} |
| 71 | + asset_path: ${{ env.ASSET }} |
| 72 | + asset_name: ${{ env.ASSET }} |
| 73 | + asset_content_type: application/octet-stream |
| 74 | + |
| 75 | + publish-tauri: |
| 76 | + permissions: |
| 77 | + contents: write |
| 78 | + strategy: |
| 79 | + fail-fast: false |
| 80 | + matrix: |
| 81 | + # TODO: Make this more consistent with the other binary |
| 82 | + platform: [macos-latest, ubuntu-20.04, windows-latest] |
| 83 | + include: |
| 84 | + - platform: macos-latest |
| 85 | + os: darwin |
| 86 | + - platform: ubuntu-20.04 |
| 87 | + os: linux # TODO: musl? |
| 88 | + - platform: windows-latest |
| 89 | + os: windows-2022 |
| 90 | + |
| 91 | + runs-on: ${{ matrix.platform }} |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v4 |
| 94 | + |
| 95 | + - name: setup node |
| 96 | + uses: actions/setup-node@v4 |
| 97 | + with: |
| 98 | + node-version: 21 |
| 99 | + |
| 100 | + - name: install Rust stable |
| 101 | + uses: dtolnay/rust-toolchain@stable |
| 102 | + |
| 103 | + - name: install dependencies (ubuntu only) |
| 104 | + if: matrix.platform == 'ubuntu-20.04' |
| 105 | + run: | |
| 106 | + sudo apt-get update |
| 107 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf |
| 108 | +
|
| 109 | + - name: install frontend dependencies |
| 110 | + run: npm install |
| 111 | + |
| 112 | + - uses: ilyagr/tauri-action@patch-1 |
| 113 | + env: |
| 114 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + # Will publish a release manually |
| 116 | + # with: |
| 117 | + # tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version |
| 118 | + # releaseName: "App v__VERSION__" |
| 119 | + # releaseBody: "See the assets to download this version and install." |
| 120 | + # releaseDraft: true |
| 121 | + # prerelease: false |
| 122 | + |
| 123 | + - name: Build archive |
| 124 | + shell: bash |
| 125 | + run: | |
| 126 | + # TODO: Create a third action to combine both in one archive |
| 127 | + outdir="target/release" |
| 128 | + name="diffedit3-gui-${{ github.event.release.tag_name }}-${{ matrix.os }}" |
| 129 | + cd "$outdir" |
| 130 | + ls # Debug |
| 131 | + if [ "${{ matrix.os }}" = "windows-2022" ]; then |
| 132 | + 7z a "../../$name.zip" diffedit3-gui.exe |
| 133 | + echo "ASSET=$name.zip" >> $GITHUB_ENV |
| 134 | + else |
| 135 | + tar czf "../../$name.tar.gz" diffedit3-gui |
| 136 | + echo "ASSET=$name.tar.gz" >> $GITHUB_ENV |
| 137 | + fi |
| 138 | + cd ../.. |
| 139 | + ls |
| 140 | + - name: Upload release archive |
| 141 | + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 |
| 142 | + env: |
| 143 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 144 | + with: |
| 145 | + upload_url: ${{ github.event.release.upload_url }} |
| 146 | + asset_path: ${{ env.ASSET }} |
| 147 | + asset_name: ${{ env.ASSET }} |
| 148 | + asset_content_type: application/octet-stream |
0 commit comments