-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 2.99 KB
/
release.yaml
File metadata and controls
90 lines (76 loc) · 2.99 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# This runs after changes are merged to `main`. There are two scenarios:
# 1. The commit was from a feature branch being merged. In this case,
# release-please will create/update a release PR to include the commit.
# 2. The commit was from a release-please PR being merged. In this case,
# the release will be tagged and the publish steps will be taken.
#
name: Release
on:
push:
branches:
- main
jobs:
release:
# TODO: Run on Ubuntu 22 as a workaround for Puppeteer issues on ubuntu-latest (24):
# https://github.com/puppeteer/puppeteer/issues/12818
runs-on: ubuntu-22.04
steps:
- name: Run release-please
uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
# Note that we need to use a custom token here because events triggered
# by the special `GITHUB_TOKEN` will not create a new workflow run (to
# avoid creating recursive workflow runs). In our case, we want this
# release-please action to trigger the `build` workflow when it pushes
# to a `release-please` branch; using a custom token here makes it work.
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Check out repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# The pnpm caching strategy in the following steps is based on:
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install pnpm
uses: pnpm/action-setup@v4.1.0
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Enable pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# pnpm-store-${{ runner.os }}-
- name: Enable Puppeteer cache
uses: actions/cache@v4
with:
path: .cache/puppeteer
key: puppeteer-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
# Save the auth token so that the build can access private packages from
# (and publish packages to) the GitHub Packages registry
- name: Configure npm auth tokens
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_ACCESS_TOKEN }}" > ~/.npmrc
- name: Install dependencies
run: |
pnpm install
- name: Install Chromium for Puppeteer
run: |
# Note: This will be a no-op if Chromium was already saved to the Puppeteer cache
pnpm dlx puppeteer browsers install
- name: Build
id: build
run: |
pnpm ci-build
- name: Publish packages
if: ${{ steps.release.outputs.releases_created == 'true' }}
run: |
pnpm -r publish