Skip to content

setup(dockerfile): update golang from 1.23.5 to 1.23.6 #6

setup(dockerfile): update golang from 1.23.5 to 1.23.6

setup(dockerfile): update golang from 1.23.5 to 1.23.6 #6

name: "Build and push PR name validator Docker image"
on:
push:
branches:
- "main"
paths-ignore:
- ".github/**"
- ".idea/**"
- "tests/**"
- "LICENSE"
- "README.md"
permissions:
contents: "read"
packages: "write"
id-token: "write"
env:
REGISTRY: "ghcr.io"
IMAGE_NAME: "articola-tools/pr-name-validator"
jobs:
build-and-push:
runs-on: "ubuntu-latest"
# NOTE: building and pushing Docker image of PR name validator linter take around 1 minute.
# If this job takes more than 5 minutes, it means that something is wrong.
timeout-minutes: 5
steps:
- name: "Checkout ${{ github.event.repository.name }}"
uses: "actions/checkout@v4"
- name: "Add short hash of current commit to environment variables"
run: "echo \"CURRENT_COMMIT_SHORT_HASH=$(git rev-parse --short \"$GITHUB_SHA\")\" >> \"$GITHUB_ENV\""
- name: "Set up Docker Buildx"
uses: "docker/setup-buildx-action@v3"
- name: "Login to Docker registry"
uses: "docker/login-action@v3"
with:
registry: "${{ env.REGISTRY }}"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "Build and push PR name validator linter Docker image"
uses: "docker/build-push-action@v6"
id: "build-and-push"
with:
context: "."
push: true
tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CURRENT_COMMIT_SHORT_HASH }}"
cache-from: "type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
cache-to: "type=inline"