generated from LiteLoaderQQNT/Plugin-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (50 loc) · 1.92 KB
/
release.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
name: "tagged-release"
on:
push:
paths:
- 'manifest.json'
jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
permissions:
contents: write
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
with:
fetch-depth: 2 # Ensure we can get the previous version
- name: "Read versions from manifest"
id: read-versions
run: |
version=$(cat manifest.json | jq -r .version)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Version: $version"
previous_version=$(git show HEAD^:manifest.json | jq -r .version)
echo "previous-version=previous_version$" >> "$GITHUB_OUTPUT"
echo "Previous version: $previous_version"
- name: "pnpm install"
if: ${{ steps.read-versions.outputs.version != steps.read-versions.outputs.previous-version }}
uses: pnpm/action-setup@v3
with:
version: latest
run_install: |
- recursive: true
- name: "pnpm build"
if: ${{ steps.read-versions.outputs.version != steps.read-versions.outputs.previous-version }}
run: |
echo "Building the project..."
pnpm run build
echo "Done!"
- name: "Zip release files" # Only if the version has been updated
if: ${{ steps.read-versions.outputs.version != steps.read-versions.outputs.previous-version }}
run: |
echo "Creating a release zip file..."
zip -r "${{github.event.repository.name}}-release.zip" dist/ LICENSE README.md manifest.json icon.svg
echo "Done!"
- name: "Create Release"
if: ${{ steps.read-versions.outputs.version != steps.read-versions.outputs.previous-version }}
run: |
gh release create "${{ steps.read-versions.outputs.version }}" *.zip --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}