-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 2.87 KB
/
release.yml
File metadata and controls
104 lines (88 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
94
95
96
97
98
99
100
101
102
103
104
name: 🚀 Release
on:
release:
types: [released]
env:
NODE_VERSION: 22
PNPM_VERSION: 10
jobs:
verify:
name: Verify tag
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.check-tag.outputs.valid }}
tag: ${{ steps.check-tag.outputs.tag }}
steps:
- name: Check Tag
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "valid=true" >> $GITHUB_OUTPUT
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
echo "tag=${TAG}" >> $GITHUB_OUTPUT
fi
server:
if: needs.verify.outputs.valid == 'true'
name: Release server
runs-on: ubuntu-latest
permissions:
packages: write
needs: verify
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: packages/server/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/drop:latest
ghcr.io/${{ github.repository_owner }}/drop:${{ needs.verify.outputs.tag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/drop:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/drop:buildcache,mode=max
plugin:
if: needs.verify.outputs.valid == 'true'
name: Release plugin
runs-on: ubuntu-latest
permissions:
contents: write
needs: verify
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
run_install: true
- name: Build package
run: pnpm build
- name: Sign package
working-directory: dist
run: |
if [[ -z "${{ secrets.PRIVATE_KEY }}" ]]; then
echo "Set an ed25519 key as PRIVATE_KEY in GitHub Action secret to sign."
else
echo "${{ secrets.PRIVATE_KEY }}" > private_key.pem
openssl pkeyutl -sign -inkey private_key.pem -out plugin_package.zip.sig -rawin -in plugin_package.zip
rm private_key.pem
fi
- name: Add files to release
working-directory: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.verify.outputs.tag }} plugin_package.zip plugin_package.zip.sig