From bd83a25f164c077b4b44febd922b27ed1ce9a6c1 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:00:54 -0800 Subject: [PATCH 1/9] ci: fix(?) pushing from the publish workflow --- .github/workflows/publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c4f9ff2533..8e48b60d96 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,6 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + token: ${{ secrets.PAT_RELEASE_PUSH }} # persists the token for pushing to the repo later - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 with: cache: 'npm' From a8abf1151d6f77cf7da8f211c5b7efdc5cbeb9d2 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:08:56 -0800 Subject: [PATCH 2/9] ci: move commitlint into its own separate workflow This way it doesn't prevent other tests from running --- .github/workflows/ci.yml | 1 - .github/workflows/commitlint.yml | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/commitlint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01e72a92fc..472bc4e0db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,6 @@ jobs: with: cache: 'npm' node-version-file: '.nvmrc' - - uses: wagoid/commitlint-github-action@9763196e10f27aef304c9b8b660d31d97fce0f99 # v5 - name: Debug info run: | cat < Date: Wed, 5 Mar 2025 15:31:51 -0800 Subject: [PATCH 3/9] ci: try again to get the push to work --- .github/workflows/publish.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8e48b60d96..719ad277f8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,21 +10,22 @@ jobs: cd: runs-on: ubuntu-latest steps: + - name: Config GitHub user + shell: bash + run: | + git config --global user.name 'GitHub Actions' + git config --global user.email 'github-actions@localhost' + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: token: ${{ secrets.PAT_RELEASE_PUSH }} # persists the token for pushing to the repo later + - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4 with: cache: 'npm' node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' - - name: Config GitHub user - shell: bash - run: | - git config --global user.name 'GitHub Actions' - git config --global user.email 'github-actions@localhost' - - uses: ./.github/actions/install-dependencies - name: Update the version in the package files From 9f9b7f1fa9cfcfd8db00b99ee903fa989c41c775 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Wed, 5 Mar 2025 19:00:06 -0800 Subject: [PATCH 4/9] ci: temporarily disable publishing to NPM --- .github/workflows/publish.yml | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 719ad277f8..b5d8b2f4db 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -40,25 +40,25 @@ jobs: - name: Build packages run: npm run build - - name: Publish scratch-svg-renderer - run: npm publish --access=public --workspace=@scratch/scratch-svg-renderer - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - - name: Publish scratch-render - run: npm publish --access=public --workspace=@scratch/scratch-render - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - - name: Publish scratch-vm - run: npm publish --access=public --workspace=@scratch/scratch-vm - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - - name: Publish scratch-gui - run: npm publish --access=public --workspace=@scratch/scratch-gui - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + # - name: Publish scratch-svg-renderer + # run: npm publish --access=public --workspace=@scratch/scratch-svg-renderer + # env: + # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + # - name: Publish scratch-render + # run: npm publish --access=public --workspace=@scratch/scratch-render + # env: + # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + # - name: Publish scratch-vm + # run: npm publish --access=public --workspace=@scratch/scratch-vm + # env: + # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + # - name: Publish scratch-gui + # run: npm publish --access=public --workspace=@scratch/scratch-gui + # env: + # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Push to develop shell: bash From cceff81e7d1f4618d15015356b489d8ff6009721 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Thu, 6 Mar 2025 08:14:52 -0800 Subject: [PATCH 5/9] ci: temporarily disable pre-build/test in publish workflow --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b5d8b2f4db..662671aa57 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,9 +5,11 @@ on: types: [published] jobs: - ci: - uses: ./.github/workflows/ci.yml + # ci: + # uses: ./.github/workflows/ci.yml cd: + # needs: + # - ci runs-on: ubuntu-latest steps: - name: Config GitHub user @@ -113,5 +115,3 @@ jobs: publish_dir: ./packages/scratch-gui/build destination_dir: scratch-gui full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}" - needs: - - ci From db6adc5df860db0a276472eaa066cb83d68b76ec Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Thu, 6 Mar 2025 07:19:07 -0800 Subject: [PATCH 6/9] ci: determine tag for "npm publish" from branch name --- .github/workflows/publish.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 662671aa57..279d0a0560 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,39 @@ jobs: # - ci runs-on: ubuntu-latest steps: + - name: Debug info + run: | + cat <> "$GITHUB_OUTPUT" + - name: Check NPM tag + run: | + if [ -z "${{ steps.npm_tag.outputs.npm_tag }}" ]; then + echo "Refusing to publish with empty NPM tag." + exit 1 + fi + - name: Config GitHub user shell: bash run: | From 2b059b62826861c0931931e164beb071892bdacc Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Thu, 6 Mar 2025 08:32:20 -0800 Subject: [PATCH 7/9] ci: make release commit message pass commitlint --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 279d0a0560..054d4af5e1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -70,7 +70,7 @@ jobs: NEW_VERSION="${GIT_TAG/v/}" npm version "$NEW_VERSION" --no-git-tag-version - git add package* && git commit -m "Release $NEW_VERSION" + git add package* && git commit -m "chore(release): $NEW_VERSION [skip ci]" - name: Build packages run: npm run build From 1754755da1cbf543d2b33cc34e3e0e7cde8a167d Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Thu, 6 Mar 2025 08:47:32 -0800 Subject: [PATCH 8/9] ci: re-enable publish steps that were disabled for testing purposes --- .github/workflows/publish.yml | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 054d4af5e1..7569372f6f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,11 +5,11 @@ on: types: [published] jobs: - # ci: - # uses: ./.github/workflows/ci.yml + ci: + uses: ./.github/workflows/ci.yml cd: - # needs: - # - ci + needs: + - ci runs-on: ubuntu-latest steps: - name: Debug info @@ -75,25 +75,25 @@ jobs: - name: Build packages run: npm run build - # - name: Publish scratch-svg-renderer - # run: npm publish --access=public --workspace=@scratch/scratch-svg-renderer - # env: - # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - # - name: Publish scratch-render - # run: npm publish --access=public --workspace=@scratch/scratch-render - # env: - # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - # - name: Publish scratch-vm - # run: npm publish --access=public --workspace=@scratch/scratch-vm - # env: - # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - # - name: Publish scratch-gui - # run: npm publish --access=public --workspace=@scratch/scratch-gui - # env: - # NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - name: Publish scratch-svg-renderer + run: npm publish --access=public --workspace=@scratch/scratch-svg-renderer + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + - name: Publish scratch-render + run: npm publish --access=public --workspace=@scratch/scratch-render + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + - name: Publish scratch-vm + run: npm publish --access=public --workspace=@scratch/scratch-vm + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + + - name: Publish scratch-gui + run: npm publish --access=public --workspace=@scratch/scratch-gui + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Push to develop shell: bash From 3f567dea77246004f0e077276f2173f4615ef4c1 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Thu, 6 Mar 2025 08:48:39 -0800 Subject: [PATCH 9/9] ci: publish to NPM under a tag determined by branch --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7569372f6f..c6eb3a888f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -76,22 +76,22 @@ jobs: run: npm run build - name: Publish scratch-svg-renderer - run: npm publish --access=public --workspace=@scratch/scratch-svg-renderer + run: npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" --workspace=@scratch/scratch-svg-renderer env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish scratch-render - run: npm publish --access=public --workspace=@scratch/scratch-render + run: npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" --workspace=@scratch/scratch-render env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish scratch-vm - run: npm publish --access=public --workspace=@scratch/scratch-vm + run: npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" --workspace=@scratch/scratch-vm env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish scratch-gui - run: npm publish --access=public --workspace=@scratch/scratch-gui + run: npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" --workspace=@scratch/scratch-gui env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}