Files
atmosphere/.github/workflows/release.yml
T

103 lines
3.3 KiB
YAML

# atmosphere · release.yml · On a version tag, builds and signs the Windows installers into a draft release, then publishes it with latest.json.
name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
check:
runs-on: windows-latest
outputs:
version: ${{ steps.v.outputs.version }}
notes: ${{ steps.v.outputs.notes }}
steps:
- uses: actions/checkout@v4
- id: v
name: Tag matches the app version
run: |
version=$(jq -r .version tauri.conf.json)
cargo_version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
tag="${GITHUB_REF_NAME#v}"
if [ "$version" != "$tag" ] || [ "$cargo_version" != "$tag" ]; then
echo "::error::Tag v$tag doesn't match tauri.conf.json ($version) and Cargo.toml ($cargo_version)."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
{
echo "notes<<ATMO_NOTES_END"
sed '/^<!--/d' RELEASE_NOTES.md
echo
cat .github/release-footer.md
echo "ATMO_NOTES_END"
} >> "$GITHUB_OUTPUT"
publish:
needs: check
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Tests
shell: bash
run: |
set -o pipefail
if ! cargo test --locked 2>&1 | tee test.log; then
grep -E "^---- |panicked at|^ left|^ right|error(\[E[0-9]+\])?:" test.log | head -40 | while IFS= read -r line; do echo "::error title=Test failure::$line"; done
exit 1
fi
- name: Install Tauri CLI
run: cargo install tauri-cli --version "^2" --locked
- name: Build, sign and publish
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
with:
tauriScript: cargo tauri
tagName: v__VERSION__
releaseName: Atmosphere __VERSION__
releaseBody: ${{ needs.check.outputs.notes }}
releaseDraft: true
prerelease: false
includeUpdaterJson: true
- name: Portable executable
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp target/release/atmosphere.exe "Atmosphere_${{ needs.check.outputs.version }}_x64-portable.exe"
gh release upload "$GITHUB_REF_NAME" "Atmosphere_${{ needs.check.outputs.version }}_x64-portable.exe" --clobber
finalize:
needs: publish
runs-on: windows-latest
steps:
- name: Drop the separate .sig files (latest.json already carries each signature)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json assets -q '.assets[].name' | grep '\.sig$' | while read -r name; do
gh release delete-asset "$GITHUB_REF_NAME" "$name" --repo "$GITHUB_REPOSITORY" -y
done
- name: Publish the release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft=false --latest