-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_npm_changelog_version_release_publish.yaml
More file actions
91 lines (81 loc) · 3.03 KB
/
Copy pathcreate_npm_changelog_version_release_publish.yaml
File metadata and controls
91 lines (81 loc) · 3.03 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
name: Create NPM Changelog + Version + Release + Publish
on:
workflow_call:
inputs:
product_name:
description: >
Name shown in the release notification. Empty uses the repository
name, which is the right answer for every product so far.
type: string
default: ""
jobs:
release:
name: Create NPM Changelog + Version + Release + Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Generate changelog and calculate version number
id: changelog
uses: TriPSs/conventional-changelog-action@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version-file: ./package.json
skip-commit: true
skip-tag: true
skip-on-empty: true
skip-version-file: true
output-file: ./CHANGELOG.md
- name: "NPM: Install"
if: ${{ steps.changelog.outputs.tag }}
run: npm ci
- name: "NPM: build"
if: ${{ steps.changelog.outputs.tag }}
run: npm run build
- name: "NPM: version"
if: ${{ steps.changelog.outputs.tag }}
run: npm version ${{ steps.changelog.outputs.version }} --no-commit-hooks --no-git-tag-version
- name: "commit changes and add tag"
uses: EndBug/add-and-commit@v9
if: ${{ steps.changelog.outputs.tag }}
with:
add: |
- CHANGELOG.md
- package.json
- package-lock.json
tag: ${{ steps.changelog.outputs.tag }}
message: "chore(release): ${{ steps.changelog.outputs.tag }} [skip ci]"
push: true
- name: Create release
id: release
if: ${{ steps.changelog.outputs.tag }}
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.github_token }}
tag_name: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
- name: "NPM: publish"
if: ${{ steps.changelog.outputs.tag }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Announce the release
# Last, so the message goes out once the package is actually on the
# registry — an announcement ahead of a failed publish points at
# something nobody can install. Only when a release was made, and
# never able to fail one.
if: ${{ steps.changelog.outputs.tag }}
continue-on-error: true
uses: NoiXdev/github-workflows/actions/announce-release@main
with:
webhook: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTIFICATION }}
tag: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
url: ${{ steps.release.outputs.url }}
product-name: ${{ inputs.product_name }}