Merge pull request #51 from RokiiApp/release-please--branches--main #136
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
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
name: release-please | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
outputs: | |
is_rokii_release: ${{ steps.release.outputs.app--release_created }} | |
rokii_release_tagname: ${{ steps.release.outputs.app--tag_name }} | |
is_release: ${{ steps.release.outputs.releases_created }} | |
steps: | |
- uses: google-github-actions/release-please-action@v4 | |
id: release | |
- name: ensure rokii is latest release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { data } = await github.rest.repos.listReleases({ | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}) | |
const lastRokiiRelease = data.find(rel => rel.tag_name.includes("rokii-v")) | |
// Mark the release as latest to make the uploader work | |
await github.rest.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: lastRokiiRelease.id, | |
make_latest: true | |
}) | |
build-app: | |
runs-on: windows-latest | |
needs: release-please | |
# Only exec the tauri action if the release comes from the app directory | |
if: needs.release-please.outputs.is_rokii_release == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 8 | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "./app/src-tauri -> target" | |
- name: Install app dependencies | |
run: pnpm i | |
- name: get release id | |
id: release_id | |
uses: actions/github-script@v7 | |
env: | |
TAGNAME: ${{ needs.release-please.outputs.rokii_release_tagname }} | |
with: | |
script: | | |
const { data } = await github.rest.repos.getReleaseByTag({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag: process.env.TAGNAME | |
}) | |
// Mark the release as latest to make the uploader work | |
await github.rest.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: data.id, | |
make_latest: true | |
}) | |
return data.id | |
- name: Build deps and test app | |
run: pnpm type-check | |
- uses: tauri-apps/tauri-action@v0 | |
id: tauri_action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
projectPath: app | |
tauriScript: pnpm tauri | |
releaseId: ${{ steps.release_id.outputs.result }} | |
publish-npm-packages: | |
runs-on: ubuntu-latest | |
needs: release-please | |
# Only exec the publish action if a new release was created | |
if: needs.release-please.outputs.is_release == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 8 | |
- name: Install deps | |
run: pnpm i | |
- name: Build packages & type check | |
run: pnpm package:type-check | |
- name: Publish packages to npm | |
run: pnpm publish -r | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |