-
Notifications
You must be signed in to change notification settings - Fork 2
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 godatadriven/release-tag-commits
Tag commits during release
- Loading branch information
Showing
1 changed file
with
15 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
contents: write | ||
id-token: write | ||
packages: write | ||
steps: | ||
|
@@ -33,6 +33,9 @@ | |
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Fetch tags | ||
run: git fetch --prune --unshallow --tags | ||
|
||
- name: Setup Python | ||
id: setup-python | ||
uses: actions/setup-python@v5 | ||
|
@@ -57,20 +60,29 @@ | |
run: poetry self add poetry-bumpversion | ||
|
||
- name: Bump version | ||
run: poetry version ${{ inputs.version_bump_type }} | ||
run: | | ||
poetry version $(git tag --sort version:refname | tail -n 1) | ||
poetry version ${{ inputs.version_bump_type }} | ||
- name: Save version to env var | ||
id: version | ||
run: echo "version=$(poetry version --short)" >> $GITHUB_OUTPUT | ||
|
||
- name: Tag commit and push | ||
run: | | ||
git config --globa user.email "[email protected]" | ||
git config --global user.name "github-actions[bot]" | ||
git tag -a ${{ steps.version.outputs.version }} -m "${{ steps.version.outputs.version }}" | ||
git push origin "${{ steps.version.outputs.version }}" | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=${{ github.sha }} | ||
type=raw,value=${{ steps.version.outputs.version }} | ||
type=raw,value=${{ github.sha }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|