Skip to content

Commit a73e87b

Browse files
authored
Create rel.yml
1 parent 8fa0285 commit a73e87b

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/rel.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Update Fork and Create Release
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '15 2 * * *'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update-and-release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
26+
- name: Configure Git
27+
run: |
28+
git config user.name github-actions
29+
git config user.email github-actions@github.com
30+
31+
- name: Update fork
32+
run: |
33+
git remote add upstream https://github.com/gnat/css-scope-inline.git
34+
git fetch upstream
35+
git merge upstream/main --no-edit
36+
git push origin main
37+
38+
- name: Get package version
39+
id: package-version
40+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
41+
42+
- name: Check if release exists
43+
id: check_release
44+
run: |
45+
release_exists=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/AnswerDotAI/css-scope-inline/releases/tags/v${{ steps.package-version.outputs.version }})
46+
if [ $release_exists -eq 200 ]; then
47+
echo "exists=true" >> $GITHUB_OUTPUT
48+
else
49+
echo "exists=false" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Create Release
53+
if: steps.check_release.outputs.exists == 'false'
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
VERSION: ${{ steps.package-version.outputs.version }}
57+
run: |
58+
gh release create v$VERSION \
59+
--title "Release v$VERSION" \
60+
--notes "Release of version $VERSION
61+
62+
Please refer to the [changelog](https://github.com/gnat/css-scope-inline/blob/main/CHANGELOG.md) for details." \
63+
--repo ${{ github.repository }}

0 commit comments

Comments
 (0)