-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (52 loc) · 1.75 KB
/
create-pr-build.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
name: Create PR Build
run-name: "PR Build: #${{ github.event.pull_request.number }} (${{ github.run_attempt }}.${{ github.run_number }}) - ${{ github.event.pull_request.title }}"
on:
pull_request:
branches:
- 'main'
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-pr-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-pr-version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get previous git tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0
- name: Get next semver from previous tag
id: next-semvers
uses: WyriHaximus/github-action-next-semvers@v1
with:
version: ${{ steps.previous-tag.outputs.tag }}
- name: Set PR version
id: set-pr-version
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
PR_ITERATION=${{ github.run_attempt }}.${{ github.run_number }}
echo "version=$(echo ${{ steps.next-semvers.outputs.patch }}-alpha+PR.${PR_NUMBER}.${PR_ITERATION})" >> $GITHUB_OUTPUT
build:
needs: ['set-pr-version']
uses: "./.github/workflows/build.yml"
secrets: inherit
with:
version: ${{ needs.set-pr-version.outputs.version }}
build-type: 'PR'
# This job is here to have only one final step to add for "Status Checks"
# in GitHub, instead of adding every leaf test from 'build'
final-check:
needs: ['build']
if: always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled'))
runs-on: ubuntu-latest
steps:
- run: exit 1