-
Notifications
You must be signed in to change notification settings - Fork 54
145 lines (127 loc) · 4.83 KB
/
release.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#################################################################################
# Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# 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.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################
---
name: "Release"
on:
pull_request:
branches:
- main
types:
- closed
workflow_call:
jobs:
# Gate
validation:
name: "Check if repository is not fork AND head is release OR base is bugfix"
runs-on: ubuntu-latest
if: ${{ github.repository == 'eclipse-tractusx/tractusx-edc' && (startsWith(github.ref_name, 'bugfix/') || startsWith(github.event.pull_request.head.ref, 'release/')) }}
outputs:
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Output release version
id: release-version
run: |
VERSION=$(grep "version" gradle.properties | awk -F= '{print $2}')
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
# Release: Maven Artifacts
maven-release:
name: Publish extension's release version to maven repository
needs: [ validation ]
permissions:
contents: read
if: needs.validation.outputs.RELEASE_VERSION
uses: ./.github/workflows/trigger-maven-publish.yaml
secrets: inherit
with:
version: ${{ needs.validation.outputs.RELEASE_VERSION }}
# Release: docker images
docker-release:
name: Publish Docker images
needs: [ validation ]
if: needs.validation.outputs.RELEASE_VERSION
uses: ./.github/workflows/trigger-docker-publish.yaml
secrets: inherit
with:
docker_tag: ${{ needs.validation.outputs.RELEASE_VERSION }}
# Release: Helm charts
helm-release:
name: Publish helm charts
needs: [ validation ]
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
if: needs.validation.outputs.RELEASE_VERSION
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-helm
- name: Package helm, update index.yaml and push to gh-pages
run: |
# Prepare git env
git config user.name "eclipse-tractusx-bot"
git config user.email "[email protected]"
# Package all charts
find charts -name Chart.yaml -not -path "./edc-tests/*" | xargs -n1 dirname | xargs -n1 helm package -u -d helm-charts
git checkout gh-pages || git checkout -b gh-pages
git pull --rebase origin gh-pages
# Generate helm repo index.yaml
helm repo index . --merge index.yaml --url https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}/
# Commit and push to gh-pages
git add index.yaml helm-charts
git commit -s -m "Release ${{ needs.validation.outputs.RELEASE_VERSION }}"
git push origin gh-pages
# Release: GitHub tag & release; Starts a new development cycle if latest release;
github-release:
name: Publish new github release
needs: [ validation, maven-release, docker-release, helm-release ]
runs-on: ubuntu-latest
permissions:
contents: write
if: needs.validation.outputs.RELEASE_VERSION
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/publish-tag-and-release
with:
version: ${{ needs.validation.outputs.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
is_latest: ${{ github.ref_name == 'main' }}
# Release: Publish specs to SwaggerHub
publish-to-swaggerhub:
name: "Publish OpenAPI spec to Swaggerhub"
permissions:
contents: read
needs: [ validation ]
uses: ./.github/workflows/publish-swaggerhub.yaml
with:
downstream-version: ${{ needs.validation.outputs.RELEASE_VERSION }}
secrets: inherit
# Release: Publish specs to GitHub Pages
publish-openapi-to-gh-pages:
name: "Publish OpenAPI UI spec GitHub Pages"
permissions:
contents: write
needs: [ validation ]
uses: ./.github/workflows/publish-openapi-ui.yml
secrets: inherit
with:
version: ${{ needs.validation.outputs.RELEASE_VERSION }}