-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (78 loc) · 2.72 KB
/
release-tck-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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#
# Contributors:
# Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
#
---
name: Create TCK Build Release
on:
workflow_dispatch:
inputs:
tck_version:
description: 'Version string that is used for publishing (e.g. "1.0.0", NOT "v1.0.0"). Appending -SNAPSHOT will create a snapshot release.'
required: true
type: string
workflow_call:
inputs:
tck_version:
description: 'Version string that is used for publishing (e.g. "1.0.0", NOT "v1.0.0"). Appending -SNAPSHOT will create a snapshot release.'
required: true
type: string
env:
TCK_VERSION: ${{ github.event.inputs.tck_version || inputs.tck_version }}
jobs:
Prepare-Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# create tag on the current branch using GitHub's own API
- name: Create tag on current branch (main)
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ env.TCK_VERSION }}',
sha: context.sha
})
outputs:
tck-version: ${{ env.TCK_VERSION }}
Github-Release:
# cannot use the workflow-level env yet as it does not yet exist, must take output from previous job
if: ${{ !endsWith( needs.Prepare-Release.outputs.tck-version, '-SNAPSHOT') }}
needs:
- Prepare-Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
tag: "v${{ env.TCK_VERSION }}"
token: ${{ secrets.GITHUB_TOKEN }}
removeArtifacts: true
Bump-Version:
name: 'Update release version'
# cannot use the workflow-level env yet as it does not yet exist, must take output from previous job
if: ${{ !endsWith( needs.Prepare-Release.outputs.tck-version, '-SNAPSHOT') }}
needs: [ Prepare-Release, Github-Release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: eclipse-dataspacetck/tck-common/.github/actions/bump-version@main
with:
target_branch: "main"
base_version: ${{ needs.Prepare-Release.outputs.tck-version }}