-
Notifications
You must be signed in to change notification settings - Fork 481
157 lines (143 loc) · 4.97 KB
/
publish-package.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: GH Release and NPM Publish
on:
workflow_dispatch:
push:
branches:
- 'next'
paths:
- 'libraries/**'
- 'internal/**'
- 'scripts/**'
- 'package.json'
- '.github/workflows/publish-package.yml'
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package: 'nostrings'
nodeVersion: '20'
typescript: 'true'
- package: 'announce'
nodeVersion: '20'
typescript: 'true'
- package: 'logger'
nodeVersion: '20'
typescript: 'true'
- package: 'seed'
nodeVersion: '20'
typescript: 'true'
- package: 'utils'
nodeVersion: '20'
typescript: 'true'
- package: 'nwcache'
nodeVersion: '20'
- package: 'controlflow'
nodeVersion: '20'
typescript: 'true'
- package: 'publisher'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-websocket-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-websocket-browser-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-info-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-dns-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-geo-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-ssl-adapter-default'
nodeVersion: '20'
typescript: 'true'
- package: 'nocap-every-adapter-default'
nodeVersion: '20'
typescript: 'true'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodeVersion }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Bootstrap Packages
run: yarn workspaces run bootstrap
if: github.workspace == 'true'
- name: Find Package
id: find_package
run: |
PKG_PATH=$(./scripts/wf/get-path-package.sh "${{ matrix.package }}")
echo "the_path=$PKG_PATH" >> "$GITHUB_OUTPUT"
- name: Install Package
id: install_package
run: |
cd "${{ steps.find_package.outputs.the_path }}"
yarn install
- name: Build Typescript
if: matrix.typescript == 'true'
run: |
cd "${{ steps.find_package.outputs.the_path }}"
yarn build
- name: Publish Package
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{ steps.find_package.outputs.the_path }}/package.json
strategy: all
access: public
- name: Set Meta
id: meta
run: |
RELEASE_SLUG="${{ matrix.package }}@v${{ steps.publish.outputs.version }}"
echo "RELEASE SLUG: $RELEASE_SLUG" >> .fml
echo "release_slug=$RELEASE_SLUG" >> "$GITHUB_OUTPUT"
- name: Check for Tag
id: slug_exists
run: |
git fetch --tags
TAG="${{ steps.meta.outputs.release_slug}}"
if git show-ref --tags --verify --quiet "refs/tags/${TAG}"; then
echo "release_slug_exists=true" >> "$GITHUB_OUTPUT"
else
echo "release_slug_exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Archive Subdirectory
if: steps.slug_exists.outputs.release_slug_exists != 'true'
id: archive
run: |
zip -r "${{ steps.meta.outputs.release_slug}}.zip" "${{ steps.find_package.outputs.the_path }}"
- name: Create Release ${{ steps.meta.outputs.release_slug }}
if: steps.publish.outputs.type != 'none' && steps.publish.outputs.dry_run != 'true' && steps.slug_exists.outputs.release_slug_exists != 'true'
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.meta.outputs.release_slug }}
release_name: ${{ steps.meta.outputs.release_slug }}
body: ""
draft: false
prerelease: true
- name: Upload Release Asset ${{ steps.meta.outputs.release_slug }}.zip
if: steps.slug_exists.outputs.release_slug_exists != 'true'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.meta.outputs.release_slug}}.zip
asset_name: ${{ steps.meta.outputs.release_slug}}.zip
asset_content_type: application/zip