Merge pull request #21 from v-bible/dev #12
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-please | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release_please: | |
runs-on: ubuntu-latest | |
# NOTE: We have to give write contents and packages permissions to the token | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
steps: | |
# NOTE: You have to turn on "Allow Github Actions to create and approve | |
# pull requests" in the org settings | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
github_publish: | |
runs-on: ubuntu-latest | |
needs: release_please | |
if: needs.release_please.outputs.release_created == 'true' | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup Node.js for GitHub Packages | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
registry-url: 'https://npm.pkg.github.com/' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Publish to GitHub Packages | |
run: pnpm publish --registry=https://npm.pkg.github.com/ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
npm_publish: | |
runs-on: ubuntu-latest | |
needs: github_publish | |
if: needs.github_publish.result == 'success' | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: Setup Node.js for npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
registry-url: 'https://registry.npmjs.org/' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Publish to npm | |
run: pnpm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |