Skip to content

Bump the github-actions-all group with 2 updates (#108) #189

Bump the github-actions-all group with 2 updates (#108)

Bump the github-actions-all group with 2 updates (#108) #189

Workflow file for this run

name: cicd
on:
# By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
# So we add default event types and ready_for_review type here.
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
tags:
- v*
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
if: github.event.pull_request.draft == false
name: Run test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: go.mod
- name: build
run: go build -v ./...
- name: test
run: go test -v ./...
# refs:
# - https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
# - https://github.com/docker/metadata-action#semver
build-and-push-image:
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request'
needs:
- test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}