bump-version #10
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
--- | |
name: "bump-version" | |
# yamllint disable-line rule:truthy | |
on: | |
workflow_dispatch: | |
inputs: | |
bump_type: | |
description: "Bump type" | |
default: "patch" | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
env: | |
GITHUB_PUSH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
jobs: | |
bump-version: | |
name: bump-version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
token: ${{ env.GITHUB_PUSH_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to GitHub Container Registry" | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
load: true | |
push: false | |
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | |
- name: Get Latest Tag | |
id: latest-tag | |
run: | | |
echo GIT_LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")" >>"$GITHUB_OUTPUT" | |
- name: Compute Next Tag | |
id: next-tag | |
run: | | |
git_next_tag="$(docker run --rm -e SEMVER_GENERATOR_INPUT -e SEMVER_GENERATOR_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }})" | |
if [[ -z "$git_next_tag" ]]; then | |
echo "Failed to compute next tag" | |
docker run --rm -e SEMVER_GENERATOR_INPUT -e SEMVER_GENERATOR_BUMP ghcr.io/${{ github.repository }}:${{ github.sha }} | |
exit 1 | |
fi | |
echo "GIT_NEXT_TAG=$git_next_tag" >>"$GITHUB_OUTPUT" | |
env: | |
SEMVER_GENERATOR_INPUT: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }} | |
SEMVER_GENERATOR_BUMP: ${{ github.event.inputs.bump_type }} | |
- name: Create and Push Tag | |
run: | | |
git config --global user.name 'Dokku Bot' | |
git config --global user.email [email protected] | |
git tag "$GIT_NEXT_TAG" | |
git push origin "$GIT_NEXT_TAG" | |
env: | |
GIT_NEXT_TAG: ${{ steps.next-tag.outputs.GIT_NEXT_TAG }} |