generated from hankei6km/my-starter-gas-lib-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.76 KB
/
types.yaml
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
name: Node.js Package(npmjs)
on:
release:
types:
- published
jobs:
labels_from_rel_note:
runs-on: ubuntu-latest
outputs:
labels: ${{ steps.collect.outputs.labels }}
steps:
- name: Collect Labels from release note
id: collect
uses: hankei6km/collect-labels-from-release-note@v0.2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
tag_name: ${{ github.event.release.tag_name }}
print_labels:
needs: labels_from_rel_note
runs-on: ubuntu-latest
steps:
- run: echo "${LABELS}"
env:
LABELS: ${{ toJson(needs.labels_from_rel_note.outputs.labels) }}
publish_types_pkg:
needs: labels_from_rel_note
# Release node に Types Changes 含むときだけ実行.
if: >-
${{ github.event.release.prerelease == false &&
contains(toJson(needs.labels_from_rel_note.outputs.labels), 'types') }}
runs-on: ubuntu-latest
environment: npm_pkg
steps:
# prerelease のような文字が含まれていたら失敗させる.
- name: Check name and tag_name
if: >-
${{ contains(github.event.release.name, 'p') ||
contains(github.event.release.tag_name, 'p') ||
contains(github.event.release.name, '-') ||
contains(github.event.release.tag_name, '-') }}
run: |
echo 'name: ${{ github.event.release.name }}'
echo 'tag_name: ${{ github.event.release.tag_name }}'
exit 1
- uses: actions/checkout@v4
# npm に公開するように .npmrc ファイルを設定する
- uses: actions/setup-node@v4
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
# https://docs.github.com/ja/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm キャッシュファイルは Linux/macOS の「~/.npm」に保存される
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
# https://dev.classmethod.jp/articles/github-actions-npm-automatic-release/
# activity type を published へ変更したので念の為
- name: can-npm-publish
run: npx can-npm-publish
- name: Install modules
run: npm ci
- name: Run tests
run: npm run test
- name: Build
run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}