-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (123 loc) · 4.23 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (123 loc) · 4.23 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
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
name: 🚀 Release Plugin
on:
workflow_dispatch:
inputs:
dry_run:
description: "Build and upload artifact without tagging or publishing"
required: true
type: boolean
default: true
version:
description: "Version to publish when dry_run is false, without the v prefix"
required: false
type: string
pull_request:
types: [closed]
branches: [main]
permissions:
contents: write
jobs:
release:
if: >-
github.event_name == 'workflow_dispatch' ||
(
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/v')
)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: 🔍 Extract version
id: meta
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
DRY_RUN="${{ inputs.dry_run }}"
VERSION="${{ inputs.version }}"
if [ "$DRY_RUN" = "true" ]; then
VERSION="${VERSION:-dry-run}"
elif ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Manual publish requires a semver version input like 1.2.3"
exit 1
fi
echo "dry_run=$DRY_RUN" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
exit 0
fi
BRANCH="${{ github.event.pull_request.head.ref }}"
VERSION="${BRANCH#release/v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Could not parse version from branch '$BRANCH'"
exit 1
fi
echo "dry_run=false" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: 📥 Checkout repository
uses: actions/checkout@v4
- name: 🔧 Install Rokit
uses: CompeyDev/setup-rokit@v0.1.2
with:
cache: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: 📋 Verify tools
run: rokit list
- name: Run Lute setup
run: lute setup
- name: 📦 Setup project
run: lute run setup
env:
ROBLOX_API_KEY: ${{ secrets.ROBLOX_API_KEY }}
- name: 🛠️ Build plugin
run: |
lute run build \
--channel prod \
--target creator-store \
--output StudioActivity.rbxm \
--skip-reload \
--clean
env:
API_HOST: activity.brooke.sh
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
- name: ✅ Verify release artifact
run: |
test -f StudioActivity.rbxm
test -f plugin/build/prod/creator-store/src/BuildVars/BuildVars.json
forbidden="$(
{
find plugin/build/prod/creator-store -path '*/DevPackages/*' -print
find plugin/build/prod/creator-store -type f \( \
-name '*.test.lua*' -o \
-name '*.story.lua*' -o \
-name '*.storybook.lua*' -o \
-name 'jest.config.lua*' \
\) -print
} | sed -n '1,200p'
)"
if [ -n "$forbidden" ]; then
echo "::error::Release artifact contains forbidden files:"
echo "$forbidden"
exit 1
fi
- name: 📤 Upload dry-run artifact
if: steps.meta.outputs.dry_run == 'true'
uses: actions/upload-artifact@v4
with:
name: StudioActivity-dry-run
path: StudioActivity.rbxm
if-no-files-found: error
- name: 🔖 Tag release
if: steps.meta.outputs.dry_run != 'true'
run: |
VERSION="${{ steps.meta.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "v$VERSION"
git push origin "v$VERSION"
- name: 🚀 Publish GitHub Release
if: steps.meta.outputs.dry_run != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.meta.outputs.version }}"
gh release create "v$VERSION" StudioActivity.rbxm \
--title "v$VERSION" \
--generate-notes