Skip to content

fix: add push on main branch to PRs (#268) #1

fix: add push on main branch to PRs (#268)

fix: add push on main branch to PRs (#268) #1

Workflow file for this run

name: Release (JS)
on:
workflow_dispatch:
push:
tags:
- "pkg/js/v*"
jobs:
test:
uses: ./.github/workflows/pkg-js-build.yaml
secrets: inherit
publish:
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: "pkg/js"
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
path: "."
sparse-checkout: "pkg/js"
sparse-checkout-cone-mode: false
- name: Set up node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
scope: "@openfga"
always-auth: false
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
runs-on: ubuntu-latest
needs: [publish]
permissions:
contents: write
packages: write # publish a new github release
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1
with:
version_regex: ^pkg/js/v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
prerelease_regex: ^pkg/js/v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-(alpha|beta)\.[[:digit:]]+$
changelog_file: pkg/js/CHANGELOG.md
create_draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}