Skip to content

Commit

Permalink
chore(repo): Fix snapshot release for v4 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosdouvlis committed Nov 8, 2023
1 parent 068aded commit cba0a49
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
21 changes: 16 additions & 5 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'Enable Playwright?'
required: false
default: 'false'
turbo-summarize:
description: 'The token to use for Turbo task summaries'
required: false
default: 'false'
turbo-enabled:
description: 'Enable Turbo?'
required: false
Expand All @@ -31,6 +35,10 @@ inputs:
turbo-token:
description: 'The token to use for Turbo remote auth'
required: true
registry-url:
description: 'The registry the packages will be published to'
required: false
default: ''

runs:
using: "composite"
Expand All @@ -44,6 +52,7 @@ runs:
CACHE_DIR: ${{ inputs.turbo-cache-dir }}
REMOTE_ONLY: ${{ inputs.turbo-remote-only }}
SIGNATURE: ${{ inputs.turbo-signature }}
SUMMARIZE: ${{ inputs.turbo-summarize }}
TEAM: ${{ inputs.turbo-team }}
TOKEN: ${{ inputs.turbo-token }}
with:
Expand All @@ -54,13 +63,14 @@ runs:
? os.availableParallelism()
: os.cpus().length;
const { ENABLED, CACHE_DIR, SIGNATURE, REMOTE_ONLY, TEAM, TOKEN } = process.env
const { ENABLED, CACHE_DIR, SIGNATURE, REMOTE_ONLY, SUMMARIZE, TEAM, TOKEN } = process.env
core.exportVariable('TURBO_ARGS',
[
'--output-logs=new-only',
`--cache-dir=${CACHE_DIR}`,
`--concurrency=${cpus}`
`--concurrency=${cpus}`,
`--summarize=${SUMMARIZE}`,
].join(' ')
)
Expand All @@ -81,16 +91,17 @@ runs:
run: echo $TURBO_ARGS

- name: Setup NodeJS ${{ inputs.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}

- name: Cache node_modules
uses: actions/cache@v3
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ inputs.node-version }}-node-modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ inputs.node-version }}-node-modules-${{ hashFiles('package-lock.json') }}

- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
Expand All @@ -114,4 +125,4 @@ runs:
- name: Install Playwright Browsers
if: inputs.playwright-enabled == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: npx playwright install --with-deps
run: npx playwright install chromium
19 changes: 15 additions & 4 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
snapshot-release:
if: ${{ startsWith(github.event.comment.body, '!snapshot') && github.repository == 'clerk/javascript' && github.event.issue.pull_request }}
runs-on: ${{ vars.RUNNER_LARGE }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
timeout-minutes: ${{ fromJSON(vars.TIMEOUT_MINUTES_NORMAL) }}

permissions:
contents: read
id-token: write

steps:
- name: Limit action to Clerk members
uses: actions/github-script@v6
Expand All @@ -40,8 +40,15 @@ jobs:
uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.issue.number }}/head

- name: Setup
uses: ./.github/actions/setup
id: config
uses: ./.github/actions/init
with:
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
turbo-team: ${{ vars.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
registry-url: "https://registry.npmjs.org"

- name: Extract snapshot name
id: extract-snapshot-name
Expand All @@ -60,6 +67,10 @@ jobs:
id: version-packages
run: npm run version:snapshot ${{ steps.extract-snapshot-name.outputs.name }} | tail -1 >> "$GITHUB_OUTPUT"

- name: Build release
if: steps.version-packages.outputs.success == '1'
run: npx turbo build $TURBO_ARGS

- name: Snapshot release
if: steps.version-packages.outputs.success == '1'
run: npm run release:snapshot
Expand Down

0 comments on commit cba0a49

Please sign in to comment.