-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from federated-wiki/fix/increase-base
introduce base version and versioning helpers
Showing
4 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Increase base version | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
previous-version: | ||
required: true | ||
type: string | ||
next-version: | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
pull-requests: write | ||
packages: write | ||
contents: write | ||
id-token: write | ||
|
||
jobs: | ||
increase-version: | ||
name: Increase version of base image | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pull-request-number: ${{ steps.pr.outputs.pull-request-number }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Upgrade version number | ||
run: | | ||
echo Increase version number from ${{ inputs.previous-version }} to ${{ inputs.next-version }} | ||
sed 's/${{ inputs.previous-version }}/${{ inputs.next-version }}/' -i Dockerfile | ||
- name: Create Pull Request, if needed | ||
id: pr | ||
if: ${{ inputs.previous-version != inputs.next-version }} | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Increase version ${{ inputs.previous-version }} to ${{ inputs.next-version }} | ||
committer: GitHub <[email protected]> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
branch: upgrade/${{ inputs.next-version }} | ||
delete-branch: true | ||
draft: false | ||
title: Increase version ${{ inputs.previous-version }} to ${{ inputs.next-version }} | ||
body: | | ||
A new wiki version ${{ inputs.next-version }} was found. | ||
Here we are updating from our old version ${{ inputs.previous-version }}. | ||
- name: Merge Pull Request, if needed | ||
if: ${{ steps.pr.outputs.pull-request-number }} != '' | ||
run: | | ||
gh pr merge --merge --auto "$PR" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR: ${{ steps.pr.outputs.pull-request-number }} | ||
|
||
call-release: | ||
name: Call version change detection workflow | ||
needs: ['increase-version'] | ||
if: needs.increase-version.outputs.pull-request-number != '' | ||
uses: ./.github/workflows/release-increased-version.yml | ||
secrets: inherit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Detect, tag and release a new version | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: false | ||
type: string | ||
default: ${{ github.ref }} | ||
|
||
permissions: | ||
pull-requests: write | ||
packages: write | ||
contents: write | ||
id-token: write | ||
|
||
jobs: | ||
tag-release: | ||
name: Tag and release a new new version | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
previous-version: ${{ steps.check-version.outputs.previous-version }} | ||
current-version: ${{ steps.check-version.outputs.current-version }} | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Detect and tag new version | ||
uses: salsify/action-detect-and-tag-new-version@v2 | ||
id: check-version | ||
with: | ||
version-command: | | ||
grep WIKI_TAG= Dockerfile | cut -d"=" -f2 | ||
- name: Release new tag | ||
uses: ncipollo/release-action@v1 | ||
if: steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version | ||
with: | ||
allowUpdates: true | ||
generateReleaseNotes: true | ||
tag: ${{ steps.check-version.outputs.tag }} | ||
updateOnlyUnreleased: true | ||
|
||
call-build-push: | ||
name: Build tagged Container image | ||
needs: ['tag-release'] | ||
uses: ./.github/workflows/ci.yml | ||
if: needs.tag-release.outputs.previous-version != needs.tag-release.outputs.current-version | ||
with: | ||
ref: "refs/tags/v${{ needs.tag-release.outputs.current-version }}" | ||
secrets: inherit |
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