-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.05 KB
/
Copy pathversioning.yml
File metadata and controls
43 lines (37 loc) · 1.05 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
name: Versioning
on:
push:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Read version from package.json
id: pkg
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
- name: Check if tag already exists
id: check
run: |
if git rev-parse "v${{ steps.pkg.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Create tag and GitHub release
if: steps.check.outputs.exists == 'false'
env:
GH_TOKEN: ${{ secrets.DATA_UPDATE_PAT }}
run: |
VERSION="v${{ steps.pkg.outputs.version }}"
git tag "$VERSION"
git push origin "$VERSION"
gh release create "$VERSION" \
--title "$VERSION" \
--generate-notes