Skip to content

Commit fc1c570

Browse files
committed
ci: modify test job in CI workflow and add release workflow
1 parent 2d5fe1a commit fc1c570

2 files changed

Lines changed: 85 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- main
77

88
jobs:
9-
deploy:
9+
test:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
@@ -23,8 +23,5 @@ jobs:
2323
run: |
2424
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/.local/bin
2525
echo "$HOME/.local/bin" >> $GITHUB_PATH
26-
- name: 🚀 Deploy 🚀
27-
run: just deploy
28-
env:
29-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
30-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
26+
- name: 🚀 Lint 🚀
27+
run: just lint

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Triggered on version tags (v*) or manually.
2+
3+
name: Release
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*'
9+
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version tag (e.g., v1.0.0, v1.0.0-beta.1)'
14+
required: true
15+
16+
jobs:
17+
validate:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
version: ${{ steps.version.outputs.version }}
21+
steps:
22+
- name: Determine version
23+
id: version
24+
run: |
25+
if [ "${{ github.event_name }}" = "push" ]; then
26+
VERSION="${{ github.ref_name }}"
27+
else
28+
VERSION="${{ inputs.version }}"
29+
fi
30+
31+
if ! echo "$VERSION" | grep -qE '^v?[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$'; then
32+
echo "Error: Invalid version format: $VERSION"
33+
echo "Expected: vMAJOR.MINOR.PATCH[-prerelease][+metadata]"
34+
exit 1
35+
fi
36+
37+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
38+
echo "Version: $VERSION"
39+
40+
test:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
fetch-depth: '0'
46+
- uses: actions/setup-node@v4
47+
with:
48+
node-version-file: '.node-version'
49+
- name: Setup pnpm
50+
uses: pnpm/action-setup@v4
51+
with:
52+
version: 10
53+
- name: Setup just
54+
run: |
55+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/.local/bin
56+
echo "$HOME/.local/bin" >> $GITHUB_PATH
57+
- name: 🚀 Lint 🚀
58+
run: just lint
59+
60+
deploy:
61+
needs: [test, validate]
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
with:
66+
fetch-depth: '0'
67+
- uses: actions/setup-node@v4
68+
with:
69+
node-version-file: '.node-version'
70+
- name: Setup pnpm
71+
uses: pnpm/action-setup@v4
72+
with:
73+
version: 10
74+
- name: Setup just
75+
run: |
76+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/.local/bin
77+
echo "$HOME/.local/bin" >> $GITHUB_PATH
78+
- name: 🚀 Deploy 🚀
79+
run: just deploy
80+
env:
81+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
82+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

0 commit comments

Comments
 (0)