-
Notifications
You must be signed in to change notification settings - Fork 12
115 lines (96 loc) · 3.25 KB
/
publish.yml
File metadata and controls
115 lines (96 loc) · 3.25 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
---
name: Publish
on:
workflow_dispatch:
workflow_run:
workflows: ["Release"]
types:
- completed
push:
branches:
- main
permissions:
contents: write
id-token: write
actions: read
jobs:
publish-ea:
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Publish EA release to NPM
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Install node 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm@11.11.1
- name: Configure git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Reset to commit
run: |
git reset --hard ${{ github.sha }}
- name: Get current version
id: current-version
run: |
VERSION=$(node -p "require('./package.json').version")
# Remove both -ea. and -ea- formats for compatibility
BASE_VERSION=$(echo "$VERSION" | sed -E 's/-ea[.-][0-9]+$//')
echo "base-version=$BASE_VERSION" >> "$GITHUB_OUTPUT"
- name: Install project modules
run: npm ci
- name: Compile project
run: npm run compile
- name: Publish package
run: |
SHORT_SHA=$(git rev-parse --short "${{ github.sha }}")
EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea.${SHORT_SHA}"
npm version "$EA_VERSION" --no-git-tag-version
npm publish --verbose --tag ea --access public --provenance
publish-release:
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
name: Publish release to NPM
steps:
- name: Get releasebranch.txt artifact from Release pipeline
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v8
with:
name: releasebranch.txt
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Read releasebranch.txt
if: github.event_name == 'workflow_run'
id: releasebranch
run: |
echo "branch=$(cat releasebranch.txt)" >> "$GITHUB_OUTPUT"
rm releasebranch.txt
- name: Checkout sources
uses: actions/checkout@v6
with:
ref: ${{ (github.event_name == 'workflow_run' && steps.releasebranch.outputs.branch) || github.ref }}
fetch-depth: 0
- name: Install node 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm@11.11.1
- name: Install project modules
run: npm ci
- name: Compile project
run: npm run compile
- name: Publish package
run: npm publish --verbose --access public --provenance