This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (71 loc) · 2.49 KB
/
next_version.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
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
81
82
name: Next version
on:
workflow_call:
inputs:
component:
required: true
type: string
outputs:
version:
description: Next version
value: ${{ jobs.next-version.outputs.version }}
dockerfile_exists:
description: Check if Dockerfile exists
value: ${{ jobs.next-version.outputs.dockerfile_exists }}
helm_chart_exists:
description: Check if Chart.yaml exists
value: ${{ jobs.next-version.outputs.helm_chart_exists }}
jobs:
next-version:
name: Get Next Version
runs-on: ubuntu-latest
steps:
# This is due to 'detached HEAD' issue
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'push'
with:
fetch-depth: 0
- name: Semver - Get Release Type
id: get_release_type
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "::set-output name=type::$(.github/scripts/pr_info.sh release_type)"
- name: Get Pull Request Number
id: get_pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "::set-output name=pull_request_number::$(.github/scripts/pr_info.sh)"
- name: Semver - Get next next version bump
id: next-version
run: |
echo ::set-output name=version::$(.github/scripts/next_semver.sh \
${{ inputs.component }} \
'${{ steps.get_pull_request.outputs.pull_request_number }}' \
'${{ steps.get_release_type.outputs.type }}' \
'0.0.0')
- name: "Check Dockerfile existence"
id: check_dockerfile
uses: andstor/file-existence-action@v2
with:
files: "${{ inputs.component }}/Dockerfile"
- name: "Check Helm Chart existence"
id: check_helm_chart
uses: andstor/file-existence-action@v2
with:
files: "${{ inputs.component }}/helm/Chart.yaml"
- name: Show version
run: |
echo "${{ steps.next-version.outputs.version }}"
echo "${{ steps.check_dockerfile.outputs.files_exists }}"
echo "${{ steps.check_helm_chart.outputs.files_exists }}"
outputs:
version: ${{ steps.next-version.outputs.version }}
dockerfile_exists: ${{ steps.check_dockerfile.outputs.files_exists }}
helm_chart_exists: ${{ steps.check_helm_chart.outputs.files_exists }}