forked from karpeychik/Kinopub
-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (65 loc) · 2.19 KB
/
release.yml
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
name: Create GitHub Release
on:
push:
branches:
- master
- github-release
jobs:
check_tag:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_version.outputs.version }}
version_exists: ${{ steps.check_tag.outputs.version_exists }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract version from package.json
id: extract_version
run: |
VERSION=$(grep 'version"' package.json | cut -d '"' -f 4)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if the tag exists
id: check_tag
run: |
if git rev-parse --quiet --verify "refs/tags/${{ steps.extract_version.outputs.version }}" >/dev/null; then
echo "The tag ${{ steps.extract_version.outputs.version }} exists. Workflow will be canceled."
echo "version_exists=true" >> $GITHUB_OUTPUT
else
echo "The tag ${{ steps.extract_version.outputs.version }} does not exist."
echo "version_exists=false" >> $GITHUB_OUTPUT
fi
tag_and_release:
runs-on: ubuntu-latest
needs: check_tag
if: ${{ needs.check_tag.outputs.version_exists == 'false' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ needs.check_tag.outputs.version }}',
sha: context.sha
})
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build
run: make
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check_tag.outputs.version }}
files: |
out/Kino.pub_${{ needs.check_tag.outputs.version }}.zip
- name: Publish Release URL
run: |
echo "Release URL: ${{ steps.create_release.outputs.upload_url }}"