Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: separate release and publish jobs #484

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

outputs:
release_created: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

steps:
- uses: googleapis/release-please-action@v4
id: release
Expand All @@ -23,40 +26,45 @@ jobs:
path: docusaurus-search-local
bump-minor-pre-major: true

# The logic below handles the npm publication:
npm-publish:

needs: release-please

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

# Ensure that a publication only occurs when a new release is created:
if: ${{ needs.release-please.outputs.release_created }}

steps:
- uses: actions/checkout@v4
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

- run: yarn install --immutable
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

- run: yarn build:theme
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}

# https://github.com/yarnpkg/berry/issues/2034#issuecomment-715295553
- run: yarn workspaces foreach --all --no-private npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.docusaurus-search-local--release_created }}
Loading