Skip to content

Commit 85e0ec0

Browse files
committed
chore: add a github action for publishing lerna from-package
1 parent faec563 commit 85e0ec0

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This workflow can be manually triggered to publish all of the plugins
2+
# that have a version in their package.json that is newer than what
3+
# is available in the npm registry. This is useful if lerna publishing
4+
# failed after a package had its version updated on github but before
5+
# that version was published to npm.
6+
7+
name: publish
8+
9+
on:
10+
workflow_dispatch: # Manually trigger. Colon is required.
11+
12+
permissions:
13+
contents: write # For checkout and tag.
14+
packages: write # For publish.
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
# Don't try to publish from a fork of google/blockly-samples.
20+
if: ${{ github.repository_owner == 'google' }}
21+
22+
# Environment specific to releasing so we can isolate the npm token.
23+
environment: release
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
# fetch all tags and commits so that lerna can version appropriately
29+
with:
30+
fetch-depth: 0
31+
ref: 'master'
32+
33+
# This uses a reverse-engineered email for the github actions bot. See
34+
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
35+
- name: Git Identity
36+
run: |
37+
git config --global user.name 'github-actions[bot]'
38+
git config --global user.email '<41898282+github-actions[bot]@users.noreply.github.com'
39+
40+
- name: Setup Node
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 20
44+
45+
- name: Configure npm
46+
run: npm config set //wombat-dressing-room.appspot.com/:_authToken=$NODE_AUTH_TOKEN
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.RELEASE_BACKED_NPM_TOKEN }}
49+
50+
- name: NPM install
51+
# Use CI so that we don't update dependencies in this step.
52+
run: npm ci
53+
54+
- name: Build
55+
run: npm run build
56+
57+
- name: Test
58+
run: npm run test
59+
60+
- name: Publish from-package
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: cd plugins && npx lerna publish from-package --yes
64+
65+
update-gh-pages:
66+
name: Update GitHub Pages
67+
# Call the Update gh-pages workflow only if publishing succeeds
68+
needs: [publish]
69+
# Don't try to auto-update if on a fork of google/blockly-samples.
70+
if: ${{ github.repository_owner == 'google' }}
71+
uses: ./.github/workflows/update_gh_pages.yml

0 commit comments

Comments
 (0)