Publish new Release #2
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: Publish new Release | |
on: workflow_dispatch | |
permissions: | |
contents: read | |
jobs: | |
publish_package: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
environment: release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install modules | |
run: yarn install | |
- name: Create NPM release | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create GitHub release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const release = require('./scripts/release.cjs') | |
const defaultBranch = "${{ github.event.repository.default_branch }}" | |
const { owner, repo } = context.repo | |
const version = require("./package.json").version | |
const versionTag = `v${version}` | |
release({ github, context, defaultBranch, versionTag }).then(() => { | |
console.log(`Release ${versionTag} created`) | |
}) |