Skip to content

Commit 8a95eb2

Browse files
authored
Merge pull request #82 from dokku/josegonzalez-patch-1
feat: add workflow to bump version in ci
2 parents 5a6a729 + bde7a9d commit 8a95eb2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: "bump-version"
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
bump_type:
9+
description: "Bump type"
10+
default: "patch"
11+
required: true
12+
type: choice
13+
options:
14+
- patch
15+
- minor
16+
- major
17+
18+
env:
19+
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
20+
21+
jobs:
22+
bump-version:
23+
name: bump-version
24+
runs-on: ubuntu-22.04
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/[email protected]
29+
with:
30+
fetch-depth: 0
31+
token: ${{ env.GITHUB_ACCESS_TOKEN }}
32+
33+
- name: Get Latest Tag
34+
id: latest-tag
35+
run: |
36+
echo GIT_LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")" >>"$GITHUB_OUTPUT"
37+
38+
- name: Compute Next Tag
39+
id: next-tag
40+
uses: docker://ghcr.io/dokku/semver-generator:latest
41+
with:
42+
bump: ${{ github.event.inputs.bump_type }}
43+
input: ${{ steps.latest-tag.outputs.GIT_LATEST_TAG }}
44+
45+
- name: Create and Push Tag
46+
run: |
47+
git config --global user.name 'Dokku Bot'
48+
git config --global user.email [email protected]
49+
git tag "$GIT_NEXT_TAG"
50+
git push origin "$GIT_NEXT_TAG"
51+
env:
52+
GIT_NEXT_TAG: ${{ steps.next-tag.outputs.version }}

0 commit comments

Comments
 (0)