Skip to content

Commit 1d1913a

Browse files
committed
Adapt release process to connector process
Signed-off-by: Lars Geyer-Blaumeiser <[email protected]>
1 parent 097e125 commit 1d1913a

File tree

4 files changed

+211
-277
lines changed

4 files changed

+211
-277
lines changed

.github/workflows/draft-new-release.yaml

Lines changed: 0 additions & 97 deletions
This file was deleted.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#################################################################################
2+
# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License, Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0.
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
# License for the specific language governing permissions and limitations
15+
# under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
#################################################################################
19+
20+
21+
---
22+
name: "Draft release"
23+
run-name: "Draft ${{ inputs.version }} from ${{ github.ref_name }}"
24+
25+
on:
26+
workflow_dispatch:
27+
inputs:
28+
version:
29+
description: 'The version you want to release.'
30+
required: true
31+
32+
jobs:
33+
validate-and-prepare:
34+
name: "Validate that tag does not already exist and prepare branch"
35+
runs-on: ubuntu-latest
36+
if: ${{ github.ref_name == 'main' || github.ref_type == 'tag' }}
37+
outputs:
38+
branch_name: ${{ steps.resolve_branch.outputs.branch_name }}
39+
is_official_release: ${{ steps.validation.outputs.is_official_release }}
40+
steps:
41+
- uses: actions/checkout@v5
42+
with:
43+
fetch-depth: 0
44+
- id: validation
45+
name: "Validations"
46+
shell: bash
47+
run: |
48+
shopt -s nocasematch
49+
IFS=.- read -r MAJOR_INPUT MINOR_INPUT PATCH_INPUT SNAPSHOT_INPUT<<<"${{ inputs.version }}"
50+
51+
VERSION=$(grep "version" gradle.properties | awk -F= '{print $2}')
52+
IFS=.- read -r MAJOR MINOR PATCH SNAPSHOT<<<"$VERSION"
53+
54+
# Release Candidate
55+
if [[ ! -z $SNAPSHOT_INPUT ]] then
56+
if [[ -z $SNAPSHOT ]] then
57+
echo "You want to build a release candidate, but the selected commit is neither on main nor a release candidate."
58+
exit 1
59+
fi
60+
61+
# Bugfix
62+
elif [[ -z $SNAPSHOT_INPUT && $PATCH_INPUT != '0' ]] then
63+
if [[ ${{ github.ref_type }} != 'tag' || ! -z $SNAPSHOT ]] then
64+
echo "You want to build a bugfix, but the selected commit is neither a bugfix nor an official release"
65+
exit 1
66+
fi
67+
68+
# Official Release
69+
elif [[ -z $SNAPSHOT_INPUT && $PATCH_INPUT == '0' ]] then
70+
if [[ ${{ github.ref_type }} != 'tag' || $SNAPSHOT != *rc* ]] then
71+
echo "You want to build an official release, but the selected commit is not a release candidate"
72+
exit 1
73+
fi
74+
fi
75+
76+
if [[ ! -z $SNAPSHOT_INPUT ]] then
77+
echo "is_official_release=false" >> "$GITHUB_OUTPUT"
78+
else
79+
echo "is_official_release=true" >> "$GITHUB_OUTPUT"
80+
fi
81+
82+
- id: check-tag
83+
name: "Check if tag exists"
84+
run: |-
85+
86+
tag=$(git tag -l ${{ inputs.version }})
87+
88+
if [ ! -z $tag ];
89+
then
90+
echo "Tag ${{ inputs.version }} already exists! Please choose another tag."
91+
exit 1
92+
fi
93+
- id: resolve_branch
94+
name: "Resolve branch name"
95+
run: |
96+
echo "branch_name=release/${{ inputs.version }}" >> "$GITHUB_OUTPUT"
97+
98+
draft-new-release:
99+
name: "Draft a new release"
100+
runs-on: ubuntu-latest
101+
needs: validate-and-prepare
102+
permissions:
103+
contents: write
104+
packages: write
105+
pages: write
106+
steps:
107+
- uses: actions/checkout@v5
108+
- name: Create release branch
109+
run: git checkout -b ${{ needs.validate-and-prepare.outputs.branch_name }}
110+
- name: Initialize mandatory git config
111+
run: |
112+
git config user.name "eclipse-tractusx-bot"
113+
git config user.email "[email protected]"
114+
- uses: ./.github/actions/setup-java
115+
- name: Check dependencies before release
116+
uses: ./.github/actions/generate-and-check-dependencies
117+
with:
118+
run: ${{ needs.validate-and-prepare.outputs.is_official_release == true && 'strict' || 'standard' }}
119+
- name: Replace published DEPENDENCIES file link in NOTICE with the one just created
120+
run: sed -i "s#\[DEPENDENCIES\]\(.*\)#\[DEPENDENCIES\]\(DEPENDENCIES\)#g" NOTICE.md
121+
- name: Version and Chart Updates
122+
uses: eclipse-tractusx/tractusx-edc/.github/actions/update-version-and-charts
123+
with:
124+
version: ${{ inputs.version }}
125+
bump_version: "false"
126+
- name: Push new branch
127+
run: git push origin release/${{ github.event.inputs.version }}

.github/workflows/publish-maven.yaml

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)