-
Notifications
You must be signed in to change notification settings - Fork 355
102 lines (89 loc) · 3.62 KB
/
Copy pathchangesets-release.yml
File metadata and controls
102 lines (89 loc) · 3.62 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
91
92
93
94
95
96
97
98
99
100
101
102
name: Changesets Release
on:
push:
branches:
- canary
- integrations/makeswift
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
jobs:
changesets-release:
name: Changesets Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Full history required for linear-release-action to scan commits.
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Packages
run: pnpm --filter "./packages/**" build
env:
CLI_SEGMENT_WRITE_KEY: ${{ secrets.CLI_SEGMENT_WRITE_KEY }}
- name: Sync Linear release
uses: linear/linear-release-action@v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: sync
# Only the storefront package ships as its own release; changes to
# other workspace packages (client, create-catalyst, the CLI) are
# released separately and shouldn't count toward this pipeline.
include_paths: core/**
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# Runs `changeset version`, then syncs core/package.json's `catalyst`
# field (version + git ref) to the freshly-bumped version.
version: pnpm changeset:version
publish: pnpm exec changeset publish
title: "Version Packages (`${{ github.ref_name }}`)"
commit: "Version Packages (`${{ github.ref_name }}`)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve headline package
id: headline
if: steps.changesets.outputs.published == 'true'
run: |
PACKAGE_NAME="@bigcommerce/catalyst-core"
if [ "${{ github.ref_name }}" = "integrations/makeswift" ]; then
PACKAGE_NAME="@bigcommerce/catalyst-makeswift"
fi
VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r --arg name "$PACKAGE_NAME" '.[] | select(.name == $name) | .version')
if [ -z "$VERSION" ]; then
echo "found=false" >> "$GITHUB_OUTPUT"
else
echo "found=true" >> "$GITHUB_OUTPUT"
echo "tag=$PACKAGE_NAME@$VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Fetch release notes
if: steps.headline.outputs.found == 'true'
run: gh release view "${{ steps.headline.outputs.tag }}" --json body -q .body > /tmp/release-notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Complete Linear release
if: steps.headline.outputs.found == 'true'
uses: linear/linear-release-action@v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: complete
# No `version`: the `catalyst-release` pipeline is a scheduled pipeline
# whose started release is unversioned (the accumulating `sync` steps
# above run without a version). Passing `version` makes `complete` look
# up an existing release with that exact version, which never exists and
# fails with `No release found with version "…"`. Omitting it completes
# the latest started release — the one sync has been accumulating into.
release_notes: /tmp/release-notes.md