version tagging on build workflow
Some checks failed
Build and Push Docker Image / build (push) Failing after 4s

This commit is contained in:
Corban-Lee Jones 2024-08-14 20:27:09 +01:00
parent d4db078a93
commit 63f2d1b341

View File

@ -21,15 +21,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install bump2version
run: pip install bump2version
- name: Get current version from bump2version
id: version
run: echo "VERSION=$(bump2version --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)" >> $GITHUB_ENV
- name: Set Docker tag based on branch
id: tag
run: |
# master branch uses specific version tagging, others use the branch name
if [[ "${{ gitea.ref_name }}" == "master" ]]; then
TAG="latest"
elif [[ "${{ gitea.ref_name }}" == "staging" ]]; then
TAG="staging"
elif [[ "${{ gitea.ref_name }}" == "dev" ]]; then
TAG="dev"
TAG="${{ env.VERSION }}"
else then
TAG="${{ gitea.ref_name }}"
fi
echo "TAG=$TAG" >> $GITHUB_ENV
@ -42,5 +48,12 @@ jobs:
- name: Tag & Push Docker image
run: |
# Push the branch-specific or version-specific tag
docker tag pyrss-website:${{ env.TAG }} xordk/pyrss-website:${{ env.TAG }}
docker push xordk/pyrss-website:${{ env.TAG }}
# If on master, push an additional "latest" tag
if [[ "${{ gitea.ref_name }}" == "master" ]]; then
docker tag pyrss-website:${{ env.TAG }} xordk/pyrss-website:latest
docker push xordk/pyrss-website:latest
fi