Skip to content

Commit

Permalink
chore(ci): setup release-please
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Sep 28, 2023
1 parent 05eb011 commit f9ffd84
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Release Please

on:
push:
branches:
- main

permissions:
contents: read

jobs:
release-please:
permissions:
id-token: write # to enable use of OIDC for npm provenance
# permissions for pushing commits and opening PRs are handled by the `generate-token` step
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-token
with:
app_id: ${{ secrets.ECOSCRIPT_APP_ID }}
private_key: ${{ secrets.ECOSCRIPT_APP_PRIVATE_KEY }}
# This action will create a release PR when regular conventional commits are pushed to main, it'll also detect if a release PR is merged and npm publish should happen
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
token: ${{ steps.generate-token.outputs.token }}

# Publish to NPM on new releases
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}
- uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.releases_created }}
- uses: actions/setup-node@v3
if: ${{ steps.release.outputs.releases_created }}
with:
cache: pnpm
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
- run: corepack enable && pnpm --version && pnpm install --ignore-scripts
if: ${{ steps.release.outputs.releases_created }}
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
# Release Please has already incremented versions and published tags, so we just
# need to publish the new version to npm here
- run: pnpm publish
if: ${{ steps.release.outputs.releases_created }}
env:
NPM_CONFIG_PROVENANCE: true
# Publish to GitHub Pages
- run: pnpm build:demo
if: ${{ steps.release.outputs.releases_created }}
- uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3
if: ${{ steps.release.outputs.releases_created }}
with:
github_token: ${{ steps.generate-token.outputs.token }}
publish_dir: ./docs

0 comments on commit f9ffd84

Please sign in to comment.