-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (76 loc) · 2.33 KB
/
release.yaml
File metadata and controls
80 lines (76 loc) · 2.33 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Release
on:
push:
branches:
- main
- next
permissions:
id-token: write # Required for OIDC
contents: write
jobs:
check_if_version_upgraded:
name: Check if package version has been upgraded
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version-updated.outputs.version }}
has_updated: ${{ steps.version-updated.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Check version changes
uses: EndBug/version-check@v3
id: version-updated
publish-js:
name: Publish JS package
runs-on: ubuntu-latest
needs:
- check_if_version_upgraded
# We create release only if the version in the package.json has been upgraded
if: |
needs.check_if_version_upgraded.outputs.has_updated == 'true'
steps:
- uses: actions/setup-node@v6
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: pnpm/action-setup@v5
with:
version: 10
- name: run tests
id: tests
run: |
pnpm install
pnpx vitest run
- name: Build Release
id: build_release
run: |
pnpm run build
- name: Create npm release
if: steps.tests.outcome == 'success'
run: |
EXTRA_ARGS="--access public --provenance"
if [[ $VERSION == *"alpha."* ]] || [[ $VERSION == *"beta."* ]] || [[ $VERSION == *"rc."* ]]; then
echo "Is pre-release version"
EXTRA_ARGS="$EXTRA_ARGS --tag next"
fi
pnpm publish $EXTRA_ARGS
env:
VERSION: ${{ needs.check_if_version_upgraded.outputs.version }}
- name: Tag release
if: steps.tests.outcome == 'success'
uses: softprops/action-gh-release@v2
with:
name: Mutable JS v${{ needs.check_if_version_upgraded.outputs.version }}
tag_name: v${{ needs.check_if_version_upgraded.outputs.version }}
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}