-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
130 lines (129 loc) · 4.38 KB
/
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
name: Publish Releases
on:
push:
branches:
- master
jobs:
sanity-check:
name: Pre-publish checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: '**/package.json'
- name: Install dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Run linters
run: npm run lint
- name: Build NodeJS package
run: npm run build
- name: Run tests
run: npm run test
npm:
name: NPM Package
needs: sanity-check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: '**/package.json'
- id: get-version
uses: ./.github/actions/get-version
- name: Install dependencies
run: npm i --ignore-scripts --no-audit --no-fund
- name: Reformat to regular markdown
run: node scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Update SDK Typescript definitions
run: node scripts/release/update-sdk-ts-defs.js
- name: Build NodeJS package
run: npm run build
- name: Deploy to NPM
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
github:
name: GitHub release
needs: sanity-check
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
- name: Get commit message (for release title and body)
id: commit
uses: kceb/git-message-action@v3
- id: get-version
uses: ./.github/actions/get-version
- name: Reformat to regular markdown
run: node scripts/release/reformat-markdown.js "${{ steps.get-version.outputs.version }}"
- name: Configure GIT credentials
run: |
git config user.name "simple-icons[bot]"
git config user.email "simple-icons[bot]@users.noreply.github.com"
# Commit that will only be included in the tag
- name: Commit CDN theme image links removal
run: |
git add README.md
git commit -m 'Replace README CDN theme image links'
- name: Create and push git tag
run: |
set -e
tag="${{ steps.get-version.outputs.version }}"
git tag -a "${tag}" -m "${{ steps.commit.outputs.git-message }}"
git push origin "${tag}"
- name: Create release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
name: ${{ steps.commit.outputs.title }}
body: ${{ steps.commit.outputs.body }}
font:
name: Trigger simple-icons-font release
needs: npm
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
repositories: 'simple-icons-font'
- name: Trigger simple-icons-font release
run: |
curl -X POST \
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \
-d '{"ref":"develop"}' \
https://api.github.com/repos/simple-icons/simple-icons-font/actions/workflows/auto-release.yml/dispatches
website:
name: Trigger simple-icons-website update
needs: npm
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
repositories: 'simple-icons-website'
- name: Trigger simple-icons-website update
run: |
curl -X POST \
-H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \
-d '{"ref":"master"}' \
https://api.github.com/repos/simple-icons/simple-icons-website/actions/workflows/auto-release.yml/dispatches