-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (60 loc) · 2.57 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Release Please
on:
push:
branches:
- main
workflow_dispatch:
inputs:
publish:
description: Publish to NPM
required: true
default: false
type: boolean
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: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.ECOSPARK_APP_ID }}
private-key: ${{ secrets.ECOSPARK_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: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.app-token.outputs.token }}
# Publish to NPM on new releases
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
- uses: pnpm/action-setup@v4
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
with:
cache: pnpm
node-version: lts/*
registry-url: "https://registry.npmjs.org"
- name: Authenticate with private NPM for installing @sanity/sanitype
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_SANITYPE_TOKEN}}
- run: pnpm install --ignore-scripts
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
if: ${{ steps.release.outputs.release_created || github.event.inputs.publish == 'true' }}
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.release_created || github.event.inputs.publish == 'true' }}
env:
NPM_CONFIG_PROVENANCE: true