-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 1.88 KB
/
Copy pathci-init.yml
File metadata and controls
61 lines (58 loc) · 1.88 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
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: ci repo initializer
# workflow_call only. This is a building block other workflows call, not
# something to run on its own: every job below reads `inputs`, and the
# `inputs` context is populated only for workflow_call. On a schedule or
# workflow_dispatch trigger `inputs.runs-on` is the empty string, so
# `fromJson('')` fails to parse and the run dies at startup with no jobs
# and no log — which is what the weekly cron did every Sunday. Running it
# standalone would only upload the repository to itself as an artifact.
'on':
workflow_call:
inputs:
artifact_name:
description: name of the artifact to use
required: false
type: string
default: source-code
artifact_upload:
description: upload artifact
required: false
type: boolean
default: true
runs-on:
description: Select github runner based on labels, default is "['ubuntu-latest']"
required: false
type: string
default: "['ubuntu-latest']"
outputs:
version:
description: Semantic version of the repository, based on the privious tag
value: ${{ jobs.init.outputs.version }}
artifact:
description: name of the artifact
value: ${{ inputs.artifact_name }}
permissions:
contents: read
jobs:
init:
name: setup artifacts and version
runs-on: ${{ fromJson(inputs.runs-on) }}
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: get version
id: version
run: |
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v6
if: ${{ inputs.artifact_upload }}
with:
name: ${{ inputs.artifact_name }}
path: ./