-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (60 loc) · 2.06 KB
/
Copy pathci.yml
File metadata and controls
72 lines (60 loc) · 2.06 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
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
name: "CI"
run-name: |
${{
(github.event_name == 'pull_request' && format('Test PR #{0}', github.event.pull_request.number)) ||
(github.ref_name == github.event.repository.default_branch && 'Release') ||
format('Test branch "{0}"', github.ref_name)
}}
on:
workflow_dispatch:
pull_request:
push:
branches: ["master"]
concurrency:
group: "${{ github.workflow }}-${{ github.ref_name }}"
cancel-in-progress: "${{ github.ref_name != github.event.repository.default_branch }}"
jobs:
create-semantic-tag:
runs-on: "ubuntu-latest"
outputs:
RELEASE_VERSION: "${{ steps.create-tag.outputs.VERSION }}"
steps:
- uses: "actions/checkout@v4"
- name: "Create semantic tag"
id: "create-tag"
run: |
if [ "${{ github.ref_name == github.event.repository.default_branch }}" != "true" ]; then
echo "Skipping tagging because it's not the default branch"
exit 0
fi
VERSION=$(git log -1 --pretty=%B | sed -nE 's/.*[Rr]elease ([0-9]+\.[0-9]+\.[0-9]+).*?/\1/p')
if [ -z "${VERSION}" ]; then
echo "No semantic version found in commit message"
exit 0
fi
echo "Adding semantic tag ${VERSION}..."
git tag "${VERSION}"
git push --tags
echo "VERSION=${VERSION}" >> "${GITHUB_OUTPUT}"
test:
needs: ["create-semantic-tag"]
uses: "./.github/workflows/test.yml"
secrets: "inherit"
build:
needs: ["test"]
uses: "./.github/workflows/build.yml"
release-latest:
if: "${{ github.ref_name == github.event.repository.default_branch }}"
needs: ["build"]
uses: "./.github/workflows/release.yml"
with:
release_name: "latest"
release-version:
if: "${{ needs.create-semantic-tag.outputs.RELEASE_VERSION != '' }}"
needs: ["create-semantic-tag", "build"]
uses: "./.github/workflows/release.yml"
with:
release_name: "${{ needs.create-semantic-tag.outputs.RELEASE_VERSION }}"
deploy-docs:
needs: ["release-latest"]
uses: "./.github/workflows/doc.yml"