Skip to content

Commit 17535c5

Browse files
authored
ci: add release please (#2)
* create release please yml * test build yml
1 parent 3e2aebe commit 17535c5

2 files changed

Lines changed: 139 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
steps:
19+
- uses: googleapis/release-please-action@v4
20+
id: release
21+
with:
22+
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
23+
release-type: node
24+
25+
build-and-release:
26+
needs: release-please
27+
if: ${{ needs.release-please.outputs.release_created }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v5
31+
32+
- uses: pnpm/action-setup@v4
33+
with:
34+
version: 9
35+
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: 24
39+
cache: 'pnpm'
40+
41+
- name: Install dependencies
42+
run: pnpm install
43+
44+
- name: Build plugin
45+
run: pnpm run build
46+
47+
- name: Create release package
48+
run: |
49+
VERSION="${{ needs.release-please.outputs.tag_name }}"
50+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
51+
RELEASE_DIR="LetUsReShade"
52+
ZIP_NAME="LetUsReShade_v${VERSION}.zip"
53+
54+
# Create temporary directory structure
55+
mkdir -p "${RELEASE_DIR}"
56+
57+
# Copy necessary files
58+
cp -r dist "${RELEASE_DIR}/"
59+
cp -r defaults "${RELEASE_DIR}/"
60+
cp main.py "${RELEASE_DIR}/"
61+
cp package.json "${RELEASE_DIR}/"
62+
cp plugin.json "${RELEASE_DIR}/"
63+
cp LICENSE "${RELEASE_DIR}/"
64+
cp README.md "${RELEASE_DIR}/"
65+
66+
# Create zip file
67+
zip -r "${ZIP_NAME}" "${RELEASE_DIR}"
68+
69+
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV
70+
71+
- name: Upload release asset
72+
env:
73+
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
74+
run: |
75+
gh release upload ${{ needs.release-please.outputs.tag_name }} \
76+
"${ZIP_NAME}" \
77+
--repo ${{ github.repository }}

.github/workflows/test-build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Test Build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_version:
7+
description: 'Test version number (e.g., 1.8.0)'
8+
required: false
9+
default: '0.0.0-test'
10+
11+
jobs:
12+
test-build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- uses: pnpm/action-setup@v4
18+
with:
19+
version: 9
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 24
24+
cache: 'pnpm'
25+
26+
- name: Install dependencies
27+
run: pnpm install
28+
29+
- name: Build plugin
30+
run: pnpm run build
31+
32+
- name: Create release package
33+
run: |
34+
VERSION="${{ github.event.inputs.test_version }}"
35+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
36+
RELEASE_DIR="LetUsReShade"
37+
ZIP_NAME="LetUsReShade_v${VERSION}.zip"
38+
39+
# Create temporary directory structure
40+
mkdir -p "${RELEASE_DIR}"
41+
42+
# Copy necessary files
43+
cp -r dist "${RELEASE_DIR}/"
44+
cp -r defaults "${RELEASE_DIR}/"
45+
cp main.py "${RELEASE_DIR}/"
46+
cp package.json "${RELEASE_DIR}/"
47+
cp plugin.json "${RELEASE_DIR}/"
48+
cp LICENSE "${RELEASE_DIR}/"
49+
cp README.md "${RELEASE_DIR}/"
50+
51+
# Create zip file
52+
zip -r "${ZIP_NAME}" "${RELEASE_DIR}"
53+
54+
echo "✅ Test build complete: ${ZIP_NAME}"
55+
ls -lh "${ZIP_NAME}"
56+
57+
- name: Upload artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: test-build
61+
path: LetUsReShade_v*.zip
62+
retention-days: 7

0 commit comments

Comments
 (0)