chore(deps): bump golang.org/x/mod from 0.21.0 to 0.22.0 #1047
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: CI | |
on: | |
release: | |
types: | |
- published | |
push: | |
branches: | |
- master | |
paths: | |
- .github/workflows/build.yml | |
- cmd/** | |
- internal/** | |
- pkg/** | |
- .dockerignore | |
- .golangci.yml | |
- Dockerfile | |
- go.mod | |
- go.sum | |
pull_request: | |
paths: | |
- .github/workflows/build.yml | |
- cmd/** | |
- internal/** | |
- pkg/** | |
- .dockerignore | |
- .golangci.yml | |
- Dockerfile | |
- go.mod | |
- go.sum | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
env: | |
DOCKER_BUILDKIT: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: reviewdog/action-misspell@v1 | |
with: | |
locale: "US" | |
level: error | |
exclude: | | |
*.md | |
- name: Linting | |
run: docker build --target lint . | |
- name: Mocks check | |
run: docker build --target mocks . | |
- name: Build test image | |
run: docker build --target test -t test-container . | |
- name: Run tests in test container | |
run: | | |
touch coverage.txt | |
docker run --rm \ | |
-v "$(pwd)/coverage.txt:/tmp/gobuild/coverage.txt" \ | |
test-container | |
- name: Build final image | |
run: docker build -t final-image . | |
codeql: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "^1.23" | |
- uses: github/codeql-action/init@v3 | |
with: | |
languages: go | |
- uses: github/codeql-action/autobuild@v3 | |
- uses: github/codeql-action/analyze@v3 | |
publish: | |
if: | | |
github.repository == 'qdm12/ddns-updater' && | |
( | |
github.event_name == 'push' || | |
github.event_name == 'release' || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') | |
) | |
needs: [verify, codeql] | |
permissions: | |
actions: read | |
contents: write | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # for gorelease last step | |
# extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
images: | | |
ghcr.io/qdm12/ddns-updater | |
qmcgaw/ddns-updater | |
tags: | | |
type=ref,event=pr | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
type=semver,pattern=v{{major}}.{{minor}}.{{patch}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=semver,pattern=v{{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: qmcgaw | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Short commit | |
id: shortcommit | |
run: echo "::set-output name=value::$(git rev-parse --short HEAD)" | |
- name: Build and push final image | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/s390x,linux/ppc64le,linux/riscv64 | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
CREATED=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} | |
COMMIT=${{ steps.shortcommit.outputs.value }} | |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
- if: github.event_name == 'release' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- if: github.event_name == 'release' | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean --config .github/workflows/configs/.goreleaser.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |