-
Notifications
You must be signed in to change notification settings - Fork 13
54 lines (46 loc) · 1.61 KB
/
publish.yaml
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
name: Build & Publish
on:
push:
branches:
- main
jobs:
Build:
uses: ./.github/workflows/build.yaml
Publish:
runs-on: ubuntu-latest
needs: [Build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || echo "No tags fetched"
- name: Get project version
id: project_version
run: echo "VERSION=$(grep -E "\s+VERSION" CMakeLists.txt | xargs | cut -d' ' -f 2)" >> $GITHUB_OUTPUT
- name: Get tag status
id: tagstatus
run: echo "TAG_EXISTS=$(git show-ref --tags --verify --quiet -- 'refs/tags/v${{ steps.project_version.outputs.VERSION }}' && echo 1 || echo 0)" >> $GITHUB_OUTPUT
- name: Print version and status
run: |
echo "Version: ${{ steps.project_version.outputs.VERSION }}"
echo "Aready exists: ${{ steps.tagstatus.outputs.TAG_EXISTS }}"
- name: Download artifacts
uses: actions/download-artifact@v4
if: steps.tagstatus.outputs.TAG_EXISTS == 0
with:
path: dist
merge-multiple: true
- name: Tag release
uses: rickstaa/action-create-tag@v1
if: steps.tagstatus.outputs.TAG_EXISTS == 0
with:
tag: "v${{ steps.project_version.outputs.VERSION }}"
- name: Release
uses: softprops/action-gh-release@v2
if: steps.tagstatus.outputs.TAG_EXISTS == 0
with:
tag_name: "v${{ steps.project_version.outputs.VERSION }}"
files: dist/*
draft: true