Release version 0.7.0 #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################# | |
# 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: "Publish new release" | |
on: | |
pull_request: | |
branches: | |
- releases | |
- support/* | |
types: | |
- closed | |
jobs: | |
# Gate: Check release version presence | |
release-version: | |
name: Determine release version | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Extract version from branch name (for release branches) | |
if: startsWith(github.event.pull_request.head.ref, 'release/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#release/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Extract version from branch name (for hotfix branches) | |
if: startsWith(github.event.pull_request.head.ref, 'hotfix/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#hotfix/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Output release version | |
id: release-version | |
run: | | |
echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}" >> $GITHUB_OUTPUT | |
# Release: Maven Artifacts | |
maven-release: | |
name: Publish extension's release version to maven repository | |
needs: [ release-version ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION | |
steps: | |
- name: Export RELEASE_VERSION env | |
run: | | |
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
# Set-Up | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-java | |
# Import GPG Key | |
- uses: ./.github/actions/import-gpg-key | |
name: "Import GPG Key" | |
with: | |
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | |
# publish releases | |
- name: Publish version | |
env: | |
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | |
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | |
run: |- | |
echo "Publishing Version $RELEASE_VERSION to Sonatype/MavenCentral" | |
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Pversion=$RELEASE_VERSION -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}" | |
docker-release: | |
name: Publish Docker images | |
runs-on: ubuntu-latest | |
needs: [ release-version ] | |
permissions: | |
contents: write | |
if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION | |
strategy: | |
fail-fast: false | |
matrix: | |
variant: [ { dir: edc-controlplane, img: edc-runtime-memory }, | |
{ dir: edc-controlplane, img: edc-controlplane-postgresql-hashicorp-vault }, | |
{ dir: edc-controlplane, img: edc-controlplane-postgresql-azure-vault }, | |
{ dir: edc-dataplane, img: edc-dataplane-azure-vault }, | |
{ dir: edc-dataplane, img: edc-dataplane-hashicorp-vault } ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export RELEASE_VERSION env | |
run: | | |
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
- uses: ./.github/actions/publish-docker-image | |
name: Publish ${{ matrix.variant.img }} | |
with: | |
docker_tag: ${{ env.RELEASE_VERSION }} | |
rootDir: ${{ matrix.variant.dir }}/${{ matrix.variant.img }} | |
imagename: ${{ matrix.variant.img }} | |
docker_user: ${{ secrets.DOCKER_HUB_USER }} | |
docker_token: ${{ secrets.DOCKER_HUB_TOKEN }} | |
do_push: 'true' | |
# Release: Helm Charts | |
helm-release: | |
name: Publish new helm release | |
needs: [ release-version ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
pages: write | |
if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION | |
steps: | |
- name: Export RELEASE_VERSION env | |
run: | | |
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.8.1 | |
- 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 ${{ env.RELEASE_VERSION }}" | |
git push origin gh-pages | |
# Release: GitHub tag & release; Merges back releases into main; Starts a new development cycle; | |
github-release: | |
name: Publish new github release | |
needs: [ release-version, maven-release, docker-release, helm-release ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
pages: write | |
pull-requests: write | |
if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION | |
steps: | |
- name: Export RELEASE_VERSION env | |
run: | | |
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
# 0 to fetch the full history due to upcoming merge of releases into main branch | |
fetch-depth: 0 | |
- name: Create Release Tag | |
id: create_release_tag | |
run: | | |
# Prepare git env | |
git config user.name "eclipse-tractusx-bot" | |
git config user.email "[email protected]" | |
# informative | |
git branch -a | |
git tag | |
# Create & push tag | |
git tag --force ${{ env.RELEASE_VERSION }} | |
git push --force origin ${{ env.RELEASE_VERSION }} | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true | |
tag: ${{ env.RELEASE_VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
makeLatest: true | |
removeArtifacts: true | |
- uses: ./.github/actions/setup-java | |
- name: Merge releases back into main and set new snapshot version | |
if: github.event.pull_request.base.ref == 'releases' | |
run: | | |
# Prepare git env | |
git config user.name "eclipse-tractusx-bot" | |
git config user.email "[email protected]" | |
# Merge releases into main | |
git checkout main && git merge -X theirs releases --no-commit --no-ff | |
# Extract release version | |
IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"${{ env.RELEASE_VERSION }}" | |
INC=0 | |
# Compute new snapshot version, do not increment snapshot on non-final releases, e.g. -rc1 | |
if [ -z $SNAPSHOT ]; then | |
# snapshot | |
echo "${{ env.RELEASE_VERSION }} is a final release version, increase patch for next snapshot" | |
INC=1 | |
else | |
echo "${{ env.RELEASE_VERSION }} is not a final release version (contains \"$SNAPSHOT\"), will not increase patch" | |
fi | |
VERSION="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+$INC))-SNAPSHOT" | |
SNAPSHOT_VERSION=$VERSION | |
# Persist the "version" in the gradle.properties | |
sed -i "s/version=.*/version=$SNAPSHOT_VERSION/g" gradle.properties | |
# Commit and push to origin main | |
git add gradle.properties | |
git commit --message "Introduce new snapshot version $SNAPSHOT_VERSION" | |
git push origin main | |
publish-to-swaggerhub: | |
name: "Publish OpenAPI spec to Swaggerhub" | |
permissions: | |
contents: read | |
needs: [ release-version ] | |
uses: ./.github/workflows/publish-swaggerhub.yaml | |
with: | |
downstream-version: ${{ needs.release-version.outputs.RELEASE_VERSION }} | |
secrets: inherit |