Skip to content

Commit

Permalink
Merge pull request #78 from dokku/bump-version
Browse files Browse the repository at this point in the history
feat: add code to bump version automatically
  • Loading branch information
josegonzalez authored Sep 14, 2024
2 parents 1b07c9e + ee6b964 commit 96c5241
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
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_ACCESS_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_ACCESS_TOKEN }}

- 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
uses: docker://ghcr.io/dokku/semver-generator:latest
with:
bump: ${{ github.event.inputs.bump_type }}
input: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }}

- 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.version }}
10 changes: 7 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: release
on:
push:
tags:
- '*'
- "*"

jobs:
docker:
Expand Down Expand Up @@ -33,7 +33,6 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -43,7 +42,12 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true

0 comments on commit 96c5241

Please sign in to comment.