-
Notifications
You must be signed in to change notification settings - Fork 338
78 lines (78 loc) · 2.71 KB
/
Copy pathrelease.yml
File metadata and controls
78 lines (78 loc) · 2.71 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
name: Release
on:
push:
tags:
- '*[0-9]*'
permissions:
contents: write
jobs:
release:
name: Build and publish release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve version
id: version
run: |
TAG_NAME="${GITHUB_REF_NAME}"
# Strip a leading "v" if present (v3.1.2 -> 3.1.2, 3.1.2 stays 3.1.2)
VERSION="${TAG_NAME#v}"
echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Releasing tag '${TAG_NAME}' (version '${VERSION}')"
- name: Sync fxmanifest.lua version
run: |
sed -i -E "s/^(version[[:space:]]+')[^']*(')/\1${{ steps.version.outputs.version }}\2/" fxmanifest.lua
grep -E "^version " fxmanifest.lua
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- name: Install web dependencies
working-directory: web
run: pnpm install --no-frozen-lockfile
- name: Build web frontend
working-directory: web
run: pnpm run build
- name: Stage release files
run: |
STAGE_DIR="release-stage/ps-mdt"
mkdir -p "${STAGE_DIR}"
cp -r client "${STAGE_DIR}/"
cp -r server "${STAGE_DIR}/"
cp -r sql "${STAGE_DIR}/"
cp -r stream "${STAGE_DIR}/"
cp config.lua "${STAGE_DIR}/"
cp fxmanifest.lua "${STAGE_DIR}/"
cp LICENSE "${STAGE_DIR}/"
cp README.md "${STAGE_DIR}/"
cp SECURITY.md "${STAGE_DIR}/"
mkdir -p "${STAGE_DIR}/web"
cp -r web/dist "${STAGE_DIR}/web/dist"
echo "Staged contents:"
find "${STAGE_DIR}" -maxdepth 3 -print
- name: Create release archive
id: archive
run: |
ARCHIVE_NAME="ps-mdt-${{ steps.version.outputs.tag }}.zip"
(cd release-stage && zip -r "../${ARCHIVE_NAME}" ps-mdt)
echo "name=${ARCHIVE_NAME}" >> "$GITHUB_OUTPUT"
ls -lh "${ARCHIVE_NAME}"
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
generate_release_notes: true
draft: false
prerelease: ${{ contains(steps.version.outputs.tag, '-') }}
make_latest: true
files: ${{ steps.archive.outputs.name }}