Skip to content

Commit 5239bde

Browse files
authored
chore: add release env to publish action to get review (#9639)
1 parent 6413d71 commit 5239bde

1 file changed

Lines changed: 43 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ jobs:
1717
ci:
1818
uses: ./.github/workflows/build.yml
1919

20-
publish:
20+
version:
2121
needs: ci
2222
runs-on: ubuntu-latest
2323
timeout-minutes: 30
24+
outputs:
25+
version: ${{ steps.version.outputs.version }}
2426
steps:
2527
- name: Checkout
2628
uses: actions/checkout@v5
@@ -56,38 +58,69 @@ jobs:
5658
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
5759
echo "New version: $VERSION"
5860
61+
- name: Update lockfile
62+
run: npm install
63+
64+
- name: Upload versioned files
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: versioned-files
68+
path: |
69+
packages/blockly/package.json
70+
package-lock.json
71+
72+
publish:
73+
needs: version
74+
runs-on: ubuntu-latest
75+
if: ${{ !inputs.dry_run }}
76+
environment: release
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@v5
80+
with:
81+
fetch-depth: 0
82+
83+
- name: Download versioned files
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: versioned-files
87+
5988
- name: Commit and push version bump
60-
if: ${{ !inputs.dry_run }}
6189
run: |
6290
git config user.name "github-actions[bot]"
6391
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6492
git add packages/blockly/package.json package-lock.json
65-
git commit -m "chore: release v${{ steps.version.outputs.version }}"
93+
git commit -m "release: v${{ needs.version.outputs.version }}"
6694
git push
6795
96+
- name: Setup Node.js
97+
uses: actions/setup-node@v5
98+
with:
99+
node-version: 22.x
100+
registry-url: 'https://registry.npmjs.org'
101+
102+
- name: Install dependencies
103+
run: npm ci
104+
68105
- name: Build package
69-
if: ${{ !inputs.dry_run }}
70106
working-directory: packages/blockly
71107
run: npm run package
72108

73109
- name: Publish to npm
74-
if: ${{ !inputs.dry_run }}
75110
working-directory: packages/blockly/dist
76111
run: npm publish
77112

78113
- name: Create tarball
79-
if: ${{ !inputs.dry_run }}
80114
working-directory: packages/blockly
81115
run: npm pack ./dist
82116

83117
- name: Create GitHub release
84-
if: ${{ !inputs.dry_run }}
85118
working-directory: packages/blockly
86119
env:
87120
GH_TOKEN: ${{ github.token }}
88121
run: |
89-
TARBALL=$(ls blockly-*.tgz)
90-
gh release create "blockly-v${{ steps.version.outputs.version }}" "$TARBALL" \
122+
TARBALL="blockly-${{ needs.version.outputs.version }}.tgz"
123+
gh release create "blockly-v${{ needs.version.outputs.version }}" "$TARBALL" \
91124
--repo "$GITHUB_REPOSITORY" \
92-
--title "blockly-v${{ steps.version.outputs.version }}" \
125+
--title "blockly-v${{ needs.version.outputs.version }}" \
93126
--generate-notes

0 commit comments

Comments
 (0)