-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (100 loc) · 2.84 KB
/
Copy pathrelease.yml
File metadata and controls
102 lines (100 loc) · 2.84 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
---
name: Release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
build-dist:
name: Build font
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dependencies
- name: Run build script
run: python3 scripts/distbuild.py "${GITHUB_REF#refs/tags/v}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
create-release:
name: Create release
needs: build-dist
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Create new release and upload assets
uses: actions/github-script@v7
with:
script: |
const {readFileSync} = require('fs')
const tagName = context.ref.replace(/^refs\/tags\//, '')
const {
data: {id: releaseId}
} = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: tagName
})
const assetFilenames = [
'saltcandy123font.zip'
]
for (const filename of assetFilenames) {
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
name: filename,
data: readFileSync(`./dist/${filename}`)
})
}
publish-to-npm-registry:
name: Publish npm package to npm registry
needs: build-dist
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package
run: |
cd dist/npm-package
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-to-github-registry:
name: Publish npm package to GitHub Packages registry
needs: build-dist
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/setup-node@v4
with:
node-version: "14.x"
registry-url: "https://npm.pkg.github.com"
scope: "@saltcandy123"
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package
run: |
cd dist/npm-package
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}