-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (118 loc) · 3.63 KB
/
npm-publish.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# TODO - Update the branch name to the main branch when testing is finished.
# name: Build, Release, and Publish
# on:
# push:
# branches:
# - main
# paths:
# - 'src/**'
# - 'build/**'
# - 'public/css/**'
# workflow_dispatch:
# jobs:
# build_and_release:
# runs-on: ubuntu-latest
# steps:
# # Step 1: Checkout the code
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# # Step 2: Setup Node.js environment
# - uses: actions/setup-node@v3
# with:
# node-version: '20.x'
# registry-url: 'https://registry.npmjs.org'
# # Step 3: Install dependencies
# - name: Install dependencies
# run: npm install
# # Step 4: Build the project
# - name: Build
# run: npm run build
# # Step 5: Semantic Release for versioning and release notes
# - name: Semantic Release
# run: npx semantic-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
# # Step 6: Configure Git if a new release is published
# - name: Configure Git for npm version
# if: ${{ steps.semantic-release.outputs.new-release-published == 'true' }}
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Designsystem"
# # Step 7: Push new tags if a new release is published
# - name: Push tags and changes
# if: ${{ steps.semantic-release.outputs.new-release-published == 'true' }}
# run: git push --follow-tags
# # Step 8: Publish to NPM only on main branch
# - name: Publish to NPM
# if: github.ref == 'refs/heads/main' && steps.semantic-release.outputs.new-release-published == 'true'
# run: npm run publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
# name: Build and Release for Test
# on:
# push:
# branches:
# - test-release
# paths:
# - 'src/**'
# - 'build/**'
# - 'public/css/**'
# workflow_dispatch:
# jobs:
# build_and_release:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: actions/setup-node@v3
# with:
# node-version: '20.x'
# registry-url: 'https://registry.npmjs.org'
# - name: Install dependencies
# run: npm install
# - name: Build
# run: npm run build
# - name: Semantic Release
# run: npx semantic-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
# - name: Configure Git for npm version
# run: |
# git config --global user.email "[email protected]"
# git config --global user.name "Designsystem"
# - name: Push tags and changes
# run: git push --follow-tags
name: Build and Release for Test
on:
push:
branches:
- test-release
paths:
- 'src/**'
- 'build/**'
- 'public/css/**'
workflow_dispatch:
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}