8
8
ci :
9
9
uses : ./.github/workflows/ci.yml
10
10
cd :
11
+ needs :
12
+ - ci
11
13
runs-on : ubuntu-latest
12
14
steps :
13
- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
14
- - uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
15
- with :
16
- cache : ' npm'
17
- node-version-file : ' .nvmrc'
18
- registry-url : ' https://registry.npmjs.org'
15
+ - name : Debug info
16
+ run : |
17
+ cat <<EOF
18
+ Release tag name: ${{ github.event.release.tag_name }}
19
+ Release target commit-ish: ${{ github.event.release.target_commitish }}
20
+ EOF
21
+
22
+ - name : Determine NPM tag
23
+ id : npm_tag
24
+ shell : bash
25
+ run : |
26
+ case ${{ github.event.release.target_commitish }} in
27
+ develop | main | master)
28
+ if [[ ${{ github.event.release.prerelease }} == true ]]; then
29
+ npm_tag=beta
30
+ else
31
+ npm_tag=latest
32
+ fi
33
+ ;;
34
+ *)
35
+ # use the branch name
36
+ npm_tag="${{ github.event.release.target_commitish }}"
37
+ ;;
38
+ esac
39
+ echo "Determined NPM tag: [$npm_tag]"
40
+ echo "npm_tag=${npm_tag}" >> "$GITHUB_OUTPUT"
41
+ - name : Check NPM tag
42
+ run : |
43
+ if [ -z "${{ steps.npm_tag.outputs.npm_tag }}" ]; then
44
+ echo "Refusing to publish with empty NPM tag."
45
+ exit 1
46
+ fi
19
47
20
48
- name : Config GitHub user
21
49
shell : bash
22
50
run : |
23
51
git config --global user.name 'GitHub Actions'
24
52
git config --global user.email 'github-actions@localhost'
25
53
54
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
55
+ with :
56
+ token : ${{ secrets.PAT_RELEASE_PUSH }} # persists the token for pushing to the repo later
57
+
58
+ - uses : actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
59
+ with :
60
+ cache : ' npm'
61
+ node-version-file : ' .nvmrc'
62
+ registry-url : ' https://registry.npmjs.org'
63
+
26
64
- uses : ./.github/actions/install-dependencies
27
65
28
66
- name : Update the version in the package files
@@ -32,28 +70,28 @@ jobs:
32
70
NEW_VERSION="${GIT_TAG/v/}"
33
71
34
72
npm version "$NEW_VERSION" --no-git-tag-version
35
- git add package* && git commit -m "Release $NEW_VERSION"
73
+ git add package* && git commit -m "chore(release): $NEW_VERSION [skip ci] "
36
74
37
75
- name : Build packages
38
76
run : npm run build
39
77
40
78
- name : Publish scratch-svg-renderer
41
- run : npm publish --access=public --workspace=@scratch/scratch-svg-renderer
79
+ run : npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" -- workspace=@scratch/scratch-svg-renderer
42
80
env :
43
81
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
44
82
45
83
- name : Publish scratch-render
46
- run : npm publish --access=public --workspace=@scratch/scratch-render
84
+ run : npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" -- workspace=@scratch/scratch-render
47
85
env :
48
86
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
49
87
50
88
- name : Publish scratch-vm
51
- run : npm publish --access=public --workspace=@scratch/scratch-vm
89
+ run : npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" -- workspace=@scratch/scratch-vm
52
90
env :
53
91
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
54
92
55
93
- name : Publish scratch-gui
56
- run : npm publish --access=public --workspace=@scratch/scratch-gui
94
+ run : npm publish --access=public --tag="${{steps.npm_tag.outputs.npm_tag}}" -- workspace=@scratch/scratch-gui
57
95
env :
58
96
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
59
97
@@ -110,5 +148,3 @@ jobs:
110
148
publish_dir : ./packages/scratch-gui/build
111
149
destination_dir : scratch-gui
112
150
full_commit_message : " Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
113
- needs :
114
- - ci
0 commit comments