Skip to content

Commit e56792a

Browse files
sebjacobschrislo
andcommitted
ci: change CI to publish to GitHub package registry
package.json changes: * namespace package under @RaspberryPiFoundation * Use github npm registry. Github workflow changes: * Remove publish workflow - this allows us to simplify publish workflow * Trigger CI workflow when `experience-cs` branch is updated * Use NPM_AUTH_TOKEN for downloading private npm packages * Use NODE_AUTH_TOKEN and grant `packages: write` permission for publishing npm package * Publish scratch-gui npm package as part of CI workflow Co-authored-by: Chris Lowis <chris.lowis@gofreerange.com>
1 parent 47408d4 commit e56792a

File tree

5 files changed

+34
-170
lines changed

5 files changed

+34
-170
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
name: CI
22

33
on:
4-
merge_group:
5-
pull_request:
6-
push: # WARNING: Renovate sometimes automerges without PR, so we MUST build and test renovate/** branches
7-
workflow_call:
8-
workflow_dispatch:
4+
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
5+
push: # Runs whenever a commit is pushed to the repository
6+
branches: [experience-cs]
7+
8+
permissions:
9+
packages: write # deploy to GitHub Packages
910

1011
concurrency:
1112
group: "${{ github.workflow }} @ ${{ github.event.compare || github.head_ref || github.ref }}"
1213
cancel-in-progress: true
1314

1415
jobs:
1516
ci:
16-
name: Detect affected packages, build and test
17+
name: Detect affected packages, build, test and publish
1718
runs-on: ubuntu-latest
1819
steps:
1920
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2021
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
2122
with:
22-
cache: 'npm'
23-
node-version-file: '.nvmrc'
23+
cache: "npm"
24+
node-version-file: ".nvmrc"
25+
registry-url: "https://npm.pkg.github.com"
2426
- uses: wagoid/commitlint-github-action@9763196e10f27aef304c9b8b660d31d97fce0f99 # v5
2527
- name: Debug info
2628
run: |
@@ -61,6 +63,8 @@ jobs:
6163
- "packages/scratch-vm/**"
6264
6365
- if: ${{ steps.filter.outputs.global == 'true' || steps.filter.outputs.any-workspace == 'true' }}
66+
env:
67+
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6468
uses: ./.github/actions/install-dependencies
6569

6670
- name: Build packages
@@ -87,3 +91,12 @@ jobs:
8791
uses: ./.github/actions/test-package
8892
with:
8993
package_name: scratch-gui
94+
95+
- name: Publish scratch-gui to GitHub Packages
96+
working-directory: ./packages/scratch-gui
97+
env:
98+
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
run: |
100+
RELEASE_VERSION="0.1.0-experience-cs.$(date +'%Y%m%d%H%M%S')"
101+
npm version --no-git-tag-version $RELEASE_VERSION
102+
npm publish --access public --tag latest

.github/workflows/publish.yml

Lines changed: 0 additions & 154 deletions
This file was deleted.

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@RaspberryPiFoundation:registry=https://npm.pkg.github.com
2+
//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN}

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/scratch-gui/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
2-
"name": "@scratch/scratch-gui",
2+
"name": "@RaspberryPiFoundation/scratch-gui",
33
"version": "11.2.0-svg-sanitization.3",
44
"description": "Graphical User Interface for creating and running Scratch 3.0 projects",
55
"author": "Massachusetts Institute of Technology",
66
"license": "AGPL-3.0-only",
7-
"homepage": "https://github.com/scratchfoundation/scratch-gui#readme",
7+
"homepage": "https://github.com/RaspberryPiFoundation/scratch-editor#readme",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/scratchfoundation/scratch-editor.git"
10+
"url": "https://github.com/RaspberryPiFoundation/scratch-editor.git"
11+
},
12+
"publishConfig": {
13+
"registry": "https://npm.pkg.github.com"
1114
},
1215
"main": "./dist/scratch-gui.js",
1316
"types": "./dist/types/index.d.ts",

0 commit comments

Comments
 (0)