-
Notifications
You must be signed in to change notification settings - Fork 14
59 lines (55 loc) · 1.61 KB
/
main.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
name: "Main workflow"
on: push
jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
check_version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
exists: ${{ steps.get-version.outputs.exists }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- id: get-version
name: Get zxlib version
run: echo "version=$(./scripts/get_version.sh)" >> $GITHUB_OUTPUT
- id: tag-exists
name: Check if version exists
run: |
if git rev-parse ${{ steps.get-version.outputs.version }} >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Fail if tag exists
if: ${{ steps.tag-exists.outputs.exists == 'true' }}
run: exit 1
tag:
runs-on: ubuntu-latest
needs:
- build
- check_version
if: ${{ needs.check_version.outputs.exists != 'true' && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.check_version.outputs.version }}