Skip to content

Draft new release

Draft new release #26

#
# 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: "Draft new release"
on:
workflow_dispatch:
inputs:
version:
description: 'The version you want to release.'
required: true
jobs:
draft-new-release:
name: "Draft a new release"
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pages: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}
- name: Initialize mandatory git config
run: |
git config user.name "eclipse-tractusx-bot"
git config user.email "[email protected]"
- uses: ./.github/actions/setup-java
- name: Bump version in gradle.properties
run: |-
# replace the project's (default) version, could be overwritten later with the -Pversion=... flag
sed -i 's/version=.*/version=${{ github.event.inputs.version }}/g' gradle.properties
env:
GITHUB_PACKAGE_USERNAME: ${{ github.actor }}
GITHUB_PACKAGE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version in /charts
uses: mikefarah/[email protected]
with:
cmd: |-
find charts -name Chart.yaml -maxdepth 3 | xargs -n1 yq -i '.appVersion = "${{ github.event.inputs.version }}" | .version = "${{ github.event.inputs.version }}"'
- name: Update Chart READMEs
uses: addnab/docker-run-action@v3
with:
image: jnorwood/helm-docs:v1.10.0
options: -v ${{ github.workspace }}/charts:/helm-docs
run: |
helm-docs --log-level debug
- name: Commit manifest files
id: make-commit
run: |
git add gradle.properties $(find charts -name Chart.yaml) $(find charts -name README.md)
git commit --message "Prepare release ${{ github.event.inputs.version }}"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push new branch
run: git push origin release/${{ github.event.inputs.version }}
- name: Create pull request
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/${{ github.event.inputs.version }}
base: releases
title: Release version ${{ github.event.inputs.version }}
reviewers: ${{ github.actor }}
body: |-
This PR was created in response to a manual trigger of the [release workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
Versions have been bumped in [commit ${{ steps.make-commit.outputs.commit }}](${{ steps.make-commit.outputs.commit }}).
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build.