Skip to content

Commit

Permalink
chore: Fix release pipeline (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens authored Mar 11, 2024
1 parent b5a9504 commit e9a3dde
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/feature-branch-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Feature branch cleanup
on:
pull_request:
types: [closed]
branches-ignore: [main]

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ jobs:
ref: "main"
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Install pnpm
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 8
run_install: false
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Set up pnpm cache
uses: actions/cache@v4
Expand All @@ -58,21 +58,21 @@ jobs:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Install dependencies
run: pnpm install
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Build
run: pnpm run build
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Publish
run: pnpm -r publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

# The logic below handles the Storybook deploy:
- name: "Restore build artifact: Storybook"
Expand All @@ -81,7 +81,7 @@ jobs:
workflow: "lint-test.yml"
name: storybook
path: dist/storybook
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -91,4 +91,4 @@ jobs:
# feature branch directories are prefixed with demo-*
# these are excluded from this action's default clean
clean-exclude: demo-*
if: ${{ steps.release.outputs.releases_created }}
if: ${{ steps.release.outputs.releases_created == 'true' }}
11 changes: 11 additions & 0 deletions documentation/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,14 @@ This will cause a major version bump in both packages on release and add its des
git merge --ff-only origin/main
git push
```

### Gotchas

Release Please uses labels to determine the status of a release.
A release PR gets the label `autorelease: pending` or `autorelease: triggered`.
When running the action again, the PR with those labels gets released, and the labels should be removed.
However, due to GitHub API failures, it's possible that the label was not removed correctly upon a previous release and Release Please thinks that the previous release is still pending.
Release Please will not create a new release PR if it thinks there is a pending release.
To fix this, check whether any closed PRs still have the `autorelease: pending` or `autorelease: triggered` labels, and remove them.

[See the Release Please docs for more information](https://github.com/googleapis/release-please?tab=readme-ov-file#release-please-bot-does-not-create-a-release-pr-why).
1 change: 0 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"bootstrap-sha": "740ff24dd3b733fae86f97b0e2740eebb5ca2b25",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"group-pull-request-title-pattern": "chore(release): Publish new release(s)",
"packages": {
"packages/css": {},
"packages/react": {},
Expand Down

0 comments on commit e9a3dde

Please sign in to comment.