Skip to content

Merge pull request #12 from Advik-B/dependabot/go_modules/google.gola… #33

Merge pull request #12 from Advik-B/dependabot/go_modules/google.gola…

Merge pull request #12 from Advik-B/dependabot/go_modules/google.gola… #33

Workflow file for this run

name: Publish Docker Image
on:
push:
branches:
- main
tags:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image tag
id: set-tag
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "tag=dev" >> $GITHUB_OUTPUT
else
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
echo "repo_owner=$(echo '${{ github.repository_owner }}' | python -c "import sys; print(sys.stdin.read().strip().lower())")" >> $GITHUB_OUTPUT
echo "repo_name=$(echo '${{ github.repository }}' | cut -d'/' -f2 | python -c "import sys; print(sys.stdin.read().strip().lower())")" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ steps.set-tag.outputs.repo_owner }}/${{ steps.set-tag.outputs.repo_name }}:${{ steps.set-tag.outputs.tag }}
ghcr.io/${{ steps.set-tag.outputs.repo_owner }}/${{ steps.set-tag.outputs.repo_name }}:latest