Skip to content

Commit

Permalink
add workflow to create release for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 22, 2023
1 parent e90eda6 commit cb1ade0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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

jobs:
release-mac:
name: Upload release binary
runs-on: macos-latest
outputs:
version: ${{ steps.info.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Get version
id: get_ver
# $GITHUB_REF will have a value like "refs/tags/v0.3.1". Extract "v0.3.1" from it
run: |
if ${{ github.event_name == 'workflow_dispatch' }}; then
ver="unreleased"
else
ver="${GITHUB_REF##refs/tags/}"
fi
echo "version=${ver}" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: v2/package-lock.json
- run: make Shiba.app
- run: zip --symlinks Shiba.app_macos_x86_64.zip -r Shiba.app
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_ver.outputs.version }}
draft: false
prerelease: ${{ github.event_name == 'workflow_dispatch' }}
files: Shiba.app_macos_x86_64.zip
5 changes: 5 additions & 0 deletions v2/scripts/gen_macos_app.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -e -o pipefail

if [[ "$OSTYPE" != darwin* ]]; then
echo 'ERROR: This script must be run on macOS' 1>&2
exit 1
fi

if [ ! -d ../.git ]; then
echo 'ERROR: This script must be run at v2 directory' 1>&2
exit 1
Expand Down

0 comments on commit cb1ade0

Please sign in to comment.