-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.87 KB
/
Copy pathrelease.yml
File metadata and controls
93 lines (79 loc) · 2.87 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
id-token: write
attestations: write
jobs:
release:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install frontend dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build backend
uses: magefile/mage-action@v3
with:
version: latest
args: buildAll
- name: Get plugin metadata
id: meta
run: |
PLUGIN_ID=$(jq -r '.id' dist/plugin.json)
PLUGIN_VERSION=$(jq -r '.info.version' dist/plugin.json)
echo "plugin-id=${PLUGIN_ID}" >> "$GITHUB_OUTPUT"
echo "plugin-version=${PLUGIN_VERSION}" >> "$GITHUB_OUTPUT"
echo "archive=${PLUGIN_ID}-${PLUGIN_VERSION}.zip" >> "$GITHUB_OUTPUT"
- name: Package plugin
run: |
cp LICENSE dist/
mv dist "${{ steps.meta.outputs.plugin-id }}"
zip -r "${{ steps.meta.outputs.archive }}" "${{ steps.meta.outputs.plugin-id }}"
sha1sum "${{ steps.meta.outputs.archive }}" | awk '{print $1}' > "${{ steps.meta.outputs.archive }}.sha1"
sha256sum "${{ steps.meta.outputs.archive }}" | awk '{print $1}' > "${{ steps.meta.outputs.archive }}.sha256"
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ steps.meta.outputs.archive }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.plugin-id }}-${{ steps.meta.outputs.plugin-version }}
path: |
${{ steps.meta.outputs.archive }}
${{ steps.meta.outputs.archive }}.sha1
${{ steps.meta.outputs.archive }}.sha256
retention-days: 7
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ github.ref_name }}" > /dev/null 2>&1; then
gh release upload "${{ github.ref_name }}" \
"${{ steps.meta.outputs.archive }}" \
"${{ steps.meta.outputs.archive }}.sha1" \
"${{ steps.meta.outputs.archive }}.sha256" --clobber
else
gh release create "${{ github.ref_name }}" \
--title "${{ steps.meta.outputs.plugin-id }} v${{ steps.meta.outputs.plugin-version }}" \
--generate-notes \
"${{ steps.meta.outputs.archive }}" \
"${{ steps.meta.outputs.archive }}.sha1" \
"${{ steps.meta.outputs.archive }}.sha256"
fi