mirror of
https://github.com/stakater/Reloader.git
synced 2026-02-14 18:09:50 +00:00
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
name: Init Release
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
TARGET_BRANCH:
|
|
description: 'TARGET_BRANCH on which release will be based'
|
|
required: true
|
|
type: string
|
|
|
|
TARGET_VERSION:
|
|
description: 'TARGET_VERSION to build kubernetes manifests with using Kustomize'
|
|
required: true
|
|
type: string
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
prepare-release:
|
|
permissions:
|
|
contents: write # for peter-evans/create-pull-request to create branch
|
|
pull-requests: write # for peter-evans/create-pull-request to create a PR
|
|
name: Automatically generate version and manifests on ${{ inputs.TARGET_BRANCH }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
ref: ${{ inputs.TARGET_BRANCH }}
|
|
|
|
- name: Check if TARGET_VERSION is well formed.
|
|
run: |
|
|
set -xue
|
|
# Target version must not contain 'v' prefix
|
|
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then
|
|
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create VERSION information
|
|
run: |
|
|
set -ue
|
|
echo "Bumping version from $(cat VERSION) to ${{ inputs.TARGET_VERSION }}"
|
|
echo "${{ inputs.TARGET_VERSION }}" > VERSION
|
|
|
|
- name: Replace latest tag with version from input
|
|
run: |
|
|
set -ue
|
|
VERSION=${{ inputs.TARGET_VERSION }} make update-manifests-version
|
|
git diff
|
|
|
|
- name: Generate new set of manifests
|
|
run: |
|
|
set -ue
|
|
make k8s-manifests
|
|
git diff
|
|
|
|
- name: Create pull request
|
|
uses: peter-evans/create-pull-request@v7.0.8
|
|
with:
|
|
commit-message: "Bump version to ${{ inputs.TARGET_VERSION }}"
|
|
title: "Bump version to ${{ inputs.TARGET_VERSION }} on ${{ inputs.TARGET_BRANCH }} branch"
|
|
body: Updating VERSION and manifests to ${{ inputs.TARGET_VERSION }}
|
|
branch: update-version
|
|
branch-suffix: random
|
|
signoff: true
|
|
labels: release
|