-
-
Notifications
You must be signed in to change notification settings - Fork 276
165 lines (146 loc) · 5.17 KB
/
tagged-releases.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
158
159
160
161
162
163
164
165
name: Tagged Release Publisher
permissions:
id-token: write
contents: write
actions: write
deployments: write
pull-requests: read
on:
workflow_dispatch:
jobs:
create-tagged-release:
name: Build and Create Tagged Release
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag
uses: project-error/get-tag@v1.0
with:
environment: "prod"
prerelease: false
id: get_tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump manifest version
run: node .github/actions/bump-manifest-version.js
env:
TGT_RELEASE_VERSION: ${{ steps.get_tag.outputs.release_tag }}
- name: Push manifest change
uses: EndBug/add-and-commit@v8
with:
add: fxmanifest.lua
push: true
author_name: Manifest Bumper
author_email: 41898282+github-actions[bot]@users.noreply.github.com
message: "chore: bump manifest version to ${{ steps.get_tag.outputs.release_tag }}"
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7.29.1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Run build
run: REACT_APP_VERSION=${{ steps.get_tag.outputs.VERSION_TAG }} pnpm build
#- name: Create Sentry Release (NPWD)
# run: |
# curl -sL https://sentry.io/get-cli/ | bash
# export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
# export SENTRY_ORG=project-error
# export SENTRY_PROJECT=npwd
# export SENTRY_URL=https://sentry.projecterror.dev/
# export VERSION=${{ steps.get_tag.outputs.VERSION_TAG }}
# sentry-cli releases new "$VERSION"
# sentry-cli releases set-commits "$VERSION" --auto
# sentry-cli releases files "$VERSION" upload-sourcemaps resources/html --ext map --url-prefix '~/resources/html'
# sentry-cli releases finalize "$VERSION"
# sentry-cli releases deploys "$VERSION" new -e production
- name: Bundle built files
run: |
mkdir -p ./temp/npwd/dist
cp ./{LICENSE,README.md,config.json,import.sql,fxmanifest.lua} ./temp/npwd/
cp -r ./dist/{game,html} ./temp/npwd/dist
cd ./temp && zip -r ../npwd.zip ./npwd
- name: Create Release
uses: "project-error/release-action@v2.1"
id: auto_release
with:
environment: "prod"
title: NPWD ${{ steps.get_tag.outputs.release_tag }}
prerelease: false
automatic_release_tag: ${{ steps.get_tag.outputs.release_tag }}
files: npwd.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/project-error/npwd/releases/${{ steps.auto_release.outputs.release_id }}/assets?name=npwd.zip" \
--data-binary "@npwd.zip"
build-npwd-packages:
name: Build NPWD packages
runs-on: ubuntu-latest
needs: create-tagged-release
steps:
- name: Get tag
run: echo ::set-output name=VERSION_TAG::${GITHUB_REF/refs\/tags\//}
id: get_tag
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7.29.1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
# Build all packages
- name: Build @npwd/types
run: |
pnpm generate:typings
cd ./packages/npwd-types
git config user.email "chip@projecterror.dev"
git config user.name "itschip"
pnpm version --new-version ${{ steps.get_tag.outputs.release_tag }}
- name: Release @npwd/types
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './packages/npwd-types/package.json'
access: 'public'
- name: Build @npwd/hooks
run: |
cd ./packages/npwd-hooks
pnpm build
git config user.email "chip@projecterror.dev"
git config user.name "itschip"
pnpm version --new-version ${{ steps.get_tag.outputs.release_tag }}
- name: Release @npwd/hooks
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './packages/npwd-hooks/package.json'
access: 'public'