Update release.yml #6
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: | |
# 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: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-20.04' | |
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/tauri-action@dev | |
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 | |
}) | |