setup(dockerfile): update linter version from 1.61.0 to 1.62.0 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build and push Go linter Docker image" | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- ".dockerignore" | |
- "Dockerfile" | |
permissions: | |
contents: "read" | |
packages: "write" | |
id-token: "write" | |
env: | |
REGISTRY: "ghcr.io" | |
IMAGE_NAME: "articola-tools/go-linter" | |
jobs: | |
build-and-push: | |
runs-on: "ubuntu-latest" | |
# NOTE: building and pushing Docker image of Go 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 Go linter Docker image" | |
uses: "docker/build-push-action@v6" | |
id: "build-and-push" | |
with: | |
# NOTE: setup of `context` is needed to force builder to use the `.dockerignore` file. | |
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" |