Skip to content

Merge pull request #20 from PartTimeLegend/renovate/peaceiris-actions… #18

Merge pull request #20 from PartTimeLegend/renovate/peaceiris-actions…

Merge pull request #20 from PartTimeLegend/renovate/peaceiris-actions… #18

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions: write-all
env:
BUILD_DATE: ${{ github.event.head_commit.timestamp }}
IMAGE_NAME: hammy-mchamilton
REPO_OWNER: hamhangout
steps:
- name: Checkout code
uses: actions/checkout@v4 # Check out your repository's code
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate build number tag
id: generate_tag
run: echo ::set-output name=tag::${GITHUB_RUN_NUMBER}
- name: Build the Docker image
run: docker build --file Dockerfile --tag ghcr.io/${{ env.REPO_OWNER }}/${{ env.IMAGE_NAME }}:${{ steps.generate_tag.outputs.tag }} --tag ghcr.io/${{ env.REPO_OWNER }}/${{ env.IMAGE_NAME }}:latest --build-arg BUILD_DATE=${BUILD_DATE} .
- name: Push the Docker image to GitHub Container Registry
run: docker push ghcr.io/${{ env.REPO_OWNER }}/${{ env.IMAGE_NAME }}:${{ steps.generate_tag.outputs.tag }} && docker push ghcr.io/${{ env.REPO_OWNER }}/${{ env.IMAGE_NAME }}:latest