-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (39 loc) · 1.23 KB
/
version-v3.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
---
name: Find the version of the current build
on:
workflow_call:
inputs:
from:
type: string
description: where to lookup the version, value can be sha or tag
required: true
runs_on:
type: string
default: ubuntu-latest-arm64
outputs:
version:
value: ${{ jobs.version.outputs.version }}
previous_version:
value: ${{ jobs.version.outputs.previous_version }}
jobs:
version:
runs-on: ${{ inputs.runs_on }}
outputs:
version: ${{ steps.git_sha.outputs.current || steps.git_tag.outputs.current }}
previous_version: ${{ steps.git_sha.outputs.previous || steps.git_tag.outputs.previous }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check from input
run: |
[[ "${{ inputs.from }}" == "sha" ]] || [[ "${{ inputs.from }}" = "tag" ]]
- name: Get version from git sha
id: git_sha
if: inputs.from == 'sha'
uses: sencrop/github-workflows/actions/lookup-git-sha@master
- name: Get version from git tag
id: git_tag
if: inputs.from == 'tag'
uses: sencrop/github-workflows/actions/lookup-git-tag@master