Create release #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
publish-tauri: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- platform: 'macos-latest' | |
args: '--bundles app --target aarch64-apple-darwin' | |
# We produce this ZIP from the "ReaBoot.app" directory | |
src: 'target/aarch64-apple-darwin/release/bundle/macos/ReaBoot.app.zip' | |
dir_containing_app_bundle: 'target/aarch64-apple-darwin/release/bundle/macos' | |
dest: 'ReaBoot-macos-arm64.zip' | |
toolchain: 1.83.0 | |
- platform: 'macos-latest' | |
args: '--target x86_64-apple-darwin' | |
# We produce this ZIP from the "ReaBoot.app" directory | |
src: 'target/x86_64-apple-darwin/release/bundle/macos/ReaBoot.app.zip' | |
dir_containing_app_bundle: 'target/x86_64-apple-darwin/release/bundle/macos' | |
dest: 'ReaBoot-macos-x86_64.zip' | |
toolchain: 1.83.0 | |
- platform: 'windows-latest' | |
args: '' | |
src: 'target/release/ReaBoot.exe' | |
dest: 'ReaBoot-windows-x64.exe' | |
# 1.77.2 is the latest toolchain that still supports Windows 7. | |
# We even downgraded cargo-platform dependency to 0.1.8 in order to be able to | |
# build with this toolchain. | |
toolchain: 1.77.2 | |
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '--bundles deb' | |
src: 'target/release/bundle/deb/ReaBoot_*_amd64.deb' | |
dest: 'ReaBoot-linux-x86_64.deb' | |
toolchain: 1.83.0 | |
runs-on: ${{ matrix.settings.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies (ubuntu only) | |
if: matrix.settings.platform == 'ubuntu-22.04' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: 'npm' | |
cache-dependency-path: gui/package-lock.json | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.settings.toolchain }} | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.settings.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
- name: Install frontend dependencies | |
working-directory: gui | |
run: npm install | |
- name: Import windows certificate | |
if: matrix.settings.platform == 'windows-latest' | |
env: | |
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | |
run: | | |
New-Item -ItemType directory -Path certificate | |
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE | |
certutil -decode certificate/tempCert.txt certificate/certificate.pfx | |
Remove-Item -path certificate -include tempCert.txt | |
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText) | |
- name: Build | |
working-directory: gui | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | |
run: npm run tauri build -- ${{ matrix.settings.args }} | |
- name: Zip app bundle | |
if: matrix.settings.platform == 'macos-latest' | |
working-directory: ${{ matrix.settings.dir_containing_app_bundle }} | |
shell: bash | |
run: | | |
zip -r ReaBoot.app.zip ReaBoot.app | |
- name: Move main asset | |
shell: bash | |
run: | | |
mkdir -p release-assets | |
mv ${{ matrix.settings.src }} "./release-assets/${{ matrix.settings.dest }}" | |
- name: Move Windows installers | |
if: matrix.settings.platform == 'windows-latest' | |
shell: bash | |
run: | | |
mv target/release/bundle/msi/ReaBoot_*_x64_en-US.msi "./release-assets/ReaBoot-windows-x64-setup.msi" | |
mv target/release/bundle/nsis/ReaBoot_*_x64-setup.exe "./release-assets/ReaBoot-windows-x64-setup.exe" | |
- name: Check if release exists | |
id: check_release | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} | |
run: | | |
if gh release view ${{ github.ref_name }} &> /dev/null; then | |
echo "RELEASE_EXISTS=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "RELEASE_EXISTS=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Create release | |
if: steps.check_release.outputs.RELEASE_EXISTS != 'true' | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} | |
run: | | |
gh release create ${{ github.ref_name }} --draft --prerelease --verify-tag | |
- name: Upload all assets | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} | |
run: | | |
gh release upload ${{ github.ref_name }} --clobber ./release-assets/* |