diff --git a/.github/actions/msi.yml b/.github/actions/msi.yml new file mode 100644 index 0000000..5bff44a --- /dev/null +++ b/.github/actions/msi.yml @@ -0,0 +1,55 @@ +name: MSI +description: Generate MSI + +inputs: +outputs: +runs: + using: "composite" + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: stable + + - name: Cache cargo and target artifacts + uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1 + + # doc: https://volks73.github.io/cargo-wix/cargo_wix + - name: Install cargo-wix + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 + with: + command: install + args: cargo-wix + + # doc: https://wixtoolset.org/docs/tools + - name: Install wixtoolset using choco + run: choco install --force -y wixtoolset --version 3.14.0 + + # workaround to get cargo-wix working + - name: Move bootstrapper.wxs and download vc_redist.x64.exe + run: | + mv wix/bootstrapper.wxs keepme + curl -LO https://aka.ms/vs/17/release/vc_redist.x64.exe + shell: bash + + - name: Run cargo-wix + uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 + with: + command: wix + args: --nocapture + + # candle generates .wixobj files and light creates an installer from it + - name: Run Candle and Light + run: | + mv ../keepme bootstrapper.wxs + candle bootstrapper.wxs -o bootstrapper.wixobj + light bootstrapper.wixobj -ext WixBalExtension.dll -o tidybee-agent.exe + working-directory: wix + + - name: Upload artifact + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + path: target\wix\tidybee-agent-0.1.0-x86_64.msi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f66d05..00dda26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,8 +60,7 @@ jobs: - name: Move binaries if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: - mv ./target/release/${{ env.BIN_NAME }} ${{ env.ARTIFACT_DIR }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ matrix.target }}/${{ matrix.os }}-${{ env.BIN_NAME }} + run: mv ./target/release/${{ env.BIN_NAME }} ${{ env.ARTIFACT_DIR }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ matrix.target }}/${{ matrix.os }}-${{ env.BIN_NAME }} - name: Move windows binaries if: matrix.os == 'windows-latest' @@ -69,6 +68,10 @@ jobs: run: | cp ./target/release/${{ env.BIN_NAME }}.exe ./${{ env.ARTIFACT_DIR }}/${{ env.BIN_NAME }}-${{ github.ref_name }}-${{ matrix.target }}/${{ matrix.os }}-${{ env.BIN_NAME }}.exe + - name: Generate MSI + if: matrix.os == 'windows-latest' + uses: ./.github/actions/msi.yml + - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -106,4 +109,4 @@ jobs: gh release upload ${{ github.ref_name }} \ ${{ env.ARTIFACT_DIR }}/x86_64-unknown-linux-gnu-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent \ ${{ env.ARTIFACT_DIR }}/x86_64-apple-darwin-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent \ - ${{ env.ARTIFACT_DIR }}/x86_64-pc-windows-msvc-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent.exe \ No newline at end of file + ${{ env.ARTIFACT_DIR }}/x86_64-pc-windows-msvc-$(echo ${{ github.ref_name }} | sed 's/v//; s/\./-/g')-tidybee-agent.exe