-
Notifications
You must be signed in to change notification settings - Fork 273
53 lines (48 loc) · 1.99 KB
/
publish-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Publish Garden release
on:
release:
# The workflow will run once the release has been published (i.e. is not in draft state anymore)
# and it will only run if it is not a pre-release. See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
types: [released]
permissions:
contents: read
jobs:
release-npm:
runs-on: macos-latest
steps:
- name: Set Environment Variables
run: echo "SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-8)" >> "$GITHUB_ENV"
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js 21.x
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 21.x
- name: Build package
run: |
npm ci
npm run build
- name: Setup npm registry authentication
working-directory: ./core
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish edge version if pre-release
if: github.event.release.prerelease == true
working-directory: ./core
run: |
CURRENT_CORE_VERSION="$(node -e "console.log(require('./package.json').version);")"
npm version "$CURRENT_CORE_VERSION-edge.$SHORT_SHA"
npm publish --tag edge
- name: Publish stable version if normal release
if: github.event.release.prerelease != true
working-directory: ./core
run: |
npm publish
release-homebrew:
uses: ./.github/workflows/reusable-create-homebrew-pr.yml
with:
release-condition: ${{ github.event.release.prerelease != true }}
release-version: ${{ github.event.release.tag_name }}
commit-message: |
This PR has been generated by the publish-release workflow after the new release
@${{ github.triggering_actor }} Please review this PR carefully and merge once Garden should be released to Homebrew.
secrets: inherit