Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Merge pull request #224 from usertour/staging #12

Merge pull request #224 from usertour/staging

Merge pull request #224 from usertour/staging #12

Workflow file for this run

name: Publish Docker Image
on:
push:
tags: ['v*']
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version (strip "v")
id: extract_tag
run: |
TAG=${GITHUB_REF#refs/tags/}
STRIPPED=${TAG#v}
echo "Git ref: $GITHUB_REF"
echo "Extracted tag: $TAG"
echo "Stripped version: $STRIPPED"
echo "VERSION=$STRIPPED" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
usertour/usertour:${{ steps.extract_tag.outputs.VERSION }}
usertour/usertour:latest
labels: |
org.opencontainers.image.version=${{ steps.extract_tag.outputs.VERSION }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Notify team on failure
if: ${{ failure() }}
uses: fjogeleit/http-request-action@v1
with:
url: ${{ secrets.BUILD_NOTIFICATION_URL }}
method: 'POST'
customHeaders: '{"Content-Type": "application/json"}'
data: '{"msg_type": "text","text": {"content": "Usertour docker image build failed"}}'