build: wip - pre-release #54
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 | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
- '.vscode/**' | |
- '.idea/**' | |
workflow_dispatch: | |
inputs: | |
production_release: | |
description: 'Production release?' | |
required: true | |
default: 'true' | |
concurrency: create-release | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
packages: read | |
jobs: | |
ci: | |
name: CI | |
uses: makerxstudio/shared-config/.github/workflows/node-ci.yml@main | |
with: | |
working-directory: . | |
node-version: 20.x | |
audit-script: npm run audit | |
compile-script: npm run check-types | |
test-script: npm run tests | |
build-website: | |
if: false | |
name: Build Website | |
uses: makerxstudio/shared-config/.github/workflows/node-build-zip.yml@main | |
with: | |
build-path: dist | |
artifact-name: website | |
static-site: true | |
static-site-env-prefix: VITE | |
needs: | |
- ci | |
create-release: | |
runs-on: [ubuntu-20.04] | |
needs: | |
- ci | |
name: Create release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Get branch name | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
id: get_branch | |
- name: install app dependencies | |
run: npm install | |
- run: npx semantic-release --dry-run | |
id: get-next-version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: create pre-release | |
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release != 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release --preid beta | |
- name: create release | |
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release | |
- name: get release ID | |
id: get-release-id | |
uses: actions/github-script@v7 | |
if: steps.get-next-version.outputs.new-release-published == 'true' | |
with: | |
script: | | |
const { data } = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag: "v${{ steps.get-next-version.outputs.new-release-version }}" | |
}) | |
return data.id | |
outputs: | |
release_published: ${{ steps.get-next-version.outputs.new-release-published }} | |
release_version: ${{ steps.get-next-version.outputs.new-release-version }} | |
release_id: ${{ steps.get-release-id.outputs.result }} | |
package-tauri: | |
needs: | |
- create-release | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [macos-latest] | |
name: Package Tauri app | |
if: ${{ needs.create-release.outputs.release_published == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- 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: bump version in package.json | |
run: | | |
sed -i '' "s/\"version\": \"0.0.0\"/\"version\": \"${{ needs.create-release.outputs.release_version }}\"/g" "src-tauri/tauri.conf.json" | |
- name: install app dependencies | |
run: npm install | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseId: ${{ needs.create-release.outputs.release_id }} |