Skip to content

Commit c547fc9

Browse files
committed
chore: update actions and README
1 parent bd39ef5 commit c547fc9

5 files changed

Lines changed: 294 additions & 255 deletions

File tree

.github/workflows/auto-tag.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/publish-plugin.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Release Plugin
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Extract version from branch
20+
id: extract_version
21+
run: |
22+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
23+
VERSION="${BRANCH_NAME#release/}"
24+
echo "version=$VERSION" >> $GITHUB_OUTPUT
25+
echo "Extracted version: $VERSION"
26+
27+
- name: Check if tag already exists
28+
id: check_tag
29+
run: |
30+
if git rev-parse --verify "refs/tags/${{ steps.extract_version.outputs.version }}" >/dev/null 2>&1; then
31+
echo "tag_exists=true" >> $GITHUB_OUTPUT
32+
echo "Tag ${{ steps.extract_version.outputs.version }} already exists"
33+
else
34+
echo "tag_exists=false" >> $GITHUB_OUTPUT
35+
echo "Tag ${{ steps.extract_version.outputs.version }} does not exist"
36+
fi
37+
38+
- name: Setup Bun
39+
if: steps.check_tag.outputs.tag_exists == 'false'
40+
uses: oven-sh/setup-bun@v1
41+
with:
42+
bun-version: latest
43+
44+
- name: Install dependencies
45+
if: steps.check_tag.outputs.tag_exists == 'false'
46+
run: bun install
47+
48+
- name: Run tests
49+
if: steps.check_tag.outputs.tag_exists == 'false'
50+
run: cd packages/plugin && bun test
51+
52+
- name: Build plugin
53+
if: steps.check_tag.outputs.tag_exists == 'false'
54+
run: |
55+
cd packages/plugin
56+
bun run build
57+
58+
- name: Create and push tag
59+
if: steps.check_tag.outputs.tag_exists == 'false'
60+
run: |
61+
git config --local user.email "action@github.com"
62+
git config --local user.name "GitHub Action"
63+
git tag -a "${{ steps.extract_version.outputs.version }}" -m "Release ${{ steps.extract_version.outputs.version }}"
64+
git push origin "${{ steps.extract_version.outputs.version }}"
65+
66+
- name: Create GitHub release
67+
if: steps.check_tag.outputs.tag_exists == 'false'
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: |
71+
VERSION="${{ steps.extract_version.outputs.version }}"
72+
cd packages/plugin
73+
74+
# Create release with plugin files
75+
gh release create "$VERSION" \
76+
--title="$VERSION" \
77+
--notes="Release $VERSION - See CHANGELOG.md for details" \
78+
--draft \
79+
main.js manifest.json styles.css
80+
81+
- name: Skip release (tag exists)
82+
if: steps.check_tag.outputs.tag_exists == 'true'
83+
run: |
84+
echo "Tag ${{ steps.extract_version.outputs.version }} already exists"
85+
echo "If you want to re-release, delete the tag first: git push --delete origin ${{ steps.extract_version.outputs.version }}"

0 commit comments

Comments
 (0)