-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from visnkmr/2
add auto release along with compatible versions for apple silicon macs as well.
- Loading branch information
Showing
1 changed file
with
134 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# - 'v*' | ||
|
||
jobs: | ||
create-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
release_id: ${{ steps.create-release.outputs.result }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: get version | ||
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | ||
- name: create release | ||
id: create-release | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const currentDate = new Date(); | ||
let isoDate = currentDate.toISOString(); // "2023-08-27T12:34:56.789Z" | ||
let tagDate = isoDate.substring(0, 10); // "2023-08-27" | ||
let tagTime = isoDate.substring(11, 19).replace(/:/g, ''); // "123456" | ||
let githubTag = `${tagDate}-${tagTime}`; | ||
const { data } = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: githubTag, | ||
name: `WFMOSSFrontend for PC v${process.env.PACKAGE_VERSION}`, | ||
body: 'Checkout commit for detailed changelog on what has changed.', | ||
draft: true, | ||
prerelease: false | ||
}) | ||
return data.id | ||
build-tauri: | ||
needs: create-release | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
settings: | ||
- host: macos-latest | ||
target: x86_64-apple-darwin | ||
os: darwin | ||
arch: amd64 | ||
- host: macos-latest | ||
target: aarch64-apple-darwin | ||
os: darwin | ||
arch: arm64 | ||
- host: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
arch: amd64 | ||
- host: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
os: linux | ||
arch: amd64 | ||
# - host: ubuntu-latest | ||
# target: aarch64-unknown-linux-gnu | ||
# os: linux | ||
# arch: arm64 | ||
|
||
name: ${{ matrix.settings.target }} | ||
runs-on: ${{ matrix.settings.host }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Rust setup | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: ${{ matrix.settings.target }} | ||
|
||
- name: Rust cache | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
workspaces: "./desktop/src-tauri -> target" | ||
|
||
- name: Uninstall Homebrew | ||
run: | | ||
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" | ||
- name: install dependencies (ubuntu only) | ||
if: contains(matrix.settings.host, 'ubuntu') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | ||
- name: install frontend dependencies | ||
run: yarn install # change this to npm or pnpm depending on which one you use | ||
- uses: tauri-apps/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: "--target ${{ matrix.settings.target }}" | ||
# tagName: ${{ env.TAG }} | ||
# the action automatically replaces \_\_VERSION\_\_ with the app version | ||
releaseName: 'App v__VERSION__' | ||
# releaseBody: 'See the assets to download this version and install.' | ||
# releaseDraft: true | ||
# prerelease: false | ||
releaseId: ${{ needs.create-release.outputs.release_id }} | ||
|
||
publish-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-20.04 | ||
needs: [create-release, build-tauri] | ||
|
||
steps: | ||
- name: publish release | ||
id: publish-release | ||
uses: actions/github-script@v6 | ||
env: | ||
release_id: ${{ needs.create-release.outputs.release_id }} | ||
with: | ||
script: | | ||
github.rest.repos.updateRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: process.env.release_id, | ||
draft: false, | ||
prerelease: false | ||
}) | ||