Release #34
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: Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]' | |
workflow_dispatch: | |
env: | |
TERM: xterm | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
defaults: | |
run: | |
working-directory: v2 | |
permissions: | |
contents: write | |
jobs: | |
info: | |
name: Collect information for release | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get_info.outputs.version }} | |
tag: ${{ steps.get_info.outputs.tag }} | |
body: ${{ steps.get_info.outputs.body }} | |
prerelease: ${{ steps.get_info.outputs.prerelease }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Collect information | |
id: get_info | |
shell: bash | |
# $GITHUB_REF will have a value like "refs/tags/v0.3.1" | |
run: | | |
if ${{ github.event_name == 'workflow_dispatch' }}; then | |
echo "version=0.0.0" >> "$GITHUB_OUTPUT" | |
echo "tag=unreleased" >> "$GITHUB_OUTPUT" | |
echo "body=Pre-release assets for testing. Built at https://github.com/rhysd/Shiba/commit/$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
else | |
echo "version=${GITHUB_REF##refs/tags/v}" >> "$GITHUB_OUTPUT" | |
echo "tag=${GITHUB_REF##refs/tags/}" >> "$GITHUB_OUTPUT" | |
echo "body=" >> "$GITHUB_OUTPUT" | |
fi | |
echo "prerelease=${{ github.event_name == 'workflow_dispatch' }}" >> "$GITHUB_OUTPUT" | |
release-mac: | |
name: Build and upload macOS package | |
# Note: Binary built on macOS 13 cannot be run on macOS 12 | |
runs-on: macos-12 | |
needs: [info] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-darwin | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
cache-dependency-path: v2/package-lock.json | |
- name: Build package | |
run: | | |
make Shiba.dmg | |
mv Shiba.dmg Shiba_v${{ needs.info.outputs.version }}.dmg | |
- name: Make binary zip for x86_64 | |
run: | | |
make target/x86_64-apple-darwin/release/shiba | |
cp target/x86_64-apple-darwin/release/shiba shiba | |
zip shiba_macos_x86_64_v${{ needs.info.outputs.version }}.zip shiba | |
rm shiba | |
- name: Make binary zip for aarch64 | |
run: | | |
make target/aarch64-apple-darwin/release/shiba | |
cp target/aarch64-apple-darwin/release/shiba shiba | |
zip shiba_macos_aarch64_v${{ needs.info.outputs.version }}.zip shiba | |
rm shiba | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.info.outputs.tag }} | |
body: ${{ needs.info.outputs.body }} | |
draft: false | |
prerelease: ${{ needs.info.outputs.prerelease }} | |
files: | | |
v2/Shiba_v${{ needs.info.outputs.version }}.dmg | |
v2/shiba_macos_x86_64_v${{ needs.info.outputs.version }}.zip | |
v2/shiba_macos_aarch64_v${{ needs.info.outputs.version }}.zip | |
release-windows: | |
name: Build and upload Windows installer and executable | |
runs-on: windows-latest | |
needs: [info] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
cache-dependency-path: v2/package-lock.json | |
- name: Install WiX | |
run: | | |
dotnet tool install --global wix | |
wix --version | |
wix extension add WixToolset.UI.wixext WixToolset.Util.wixext | |
- name: Build executable | |
run: | | |
npm ci | |
npm run release | |
cargo build --release | |
cp target/release/shiba.exe shiba.exe | |
7z a shiba_windows_x86_64_v${{ needs.info.outputs.version }}.exe.zip shiba.exe | |
- name: Build .msi installer | |
run: | | |
wix --version | |
wix build -arch "x64" -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -out shiba_x64_v${{ needs.info.outputs.version }}.msi assets/wix/shiba.wxs -define ShibaVersion=${{ needs.info.outputs.version }} | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.info.outputs.tag }} | |
body: ${{ needs.info.outputs.body }} | |
draft: false | |
prerelease: ${{ needs.info.outputs.prerelease }} | |
files: | | |
v2/shiba_windows_x86_64_v${{ needs.info.outputs.version }}.exe.zip | |
v2/shiba_x64_v${{ needs.info.outputs.version }}.msi | |
release-linux: | |
name: Build and upload Linux executable | |
runs-on: ubuntu-latest | |
needs: [info] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: npm | |
cache-dependency-path: v2/package-lock.json | |
- run: sudo bash ./scripts/install_apt_deps.bash | |
- run: make target/release/shiba | |
- name: Archivfe executable | |
run: | | |
cp target/release/shiba ./shiba | |
zip --symlinks shiba_linux_x86_64_v${{ needs.info.outputs.version }}.zip shiba | |
- name: Build .deb package | |
run: | | |
set -x | |
cargo install cargo-deb | |
cargo deb --no-build --verbose | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.info.outputs.tag }} | |
body: ${{ needs.info.outputs.body }} | |
draft: false | |
prerelease: ${{ needs.info.outputs.prerelease }} | |
files: | | |
v2/shiba_linux_x86_64_v${{ needs.info.outputs.version }}.zip | |
v2/target/debian/shiba_${{ needs.info.outputs.version }}_amd64.deb |