Switch to semantic version tags for GitHub Actions instead of SHAs for better maintainability

This commit is contained in:
Damir Mukimov 2025-11-27 04:29:15 +01:00
parent 36a9e97fc8
commit 39fae4dbf8
No known key found for this signature in database
GPG Key ID: 42996CC7C73BC750
3 changed files with 27 additions and 27 deletions

View File

@ -17,13 +17,13 @@ jobs:
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@ -31,7 +31,7 @@ jobs:
- name: Extract metadata - name: Extract metadata
id: meta id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 uses: docker/metadata-action@v5
with: with:
images: ghcr.io/${{ github.repository }} images: ghcr.io/${{ github.repository }}
tags: | tags: |
@ -43,7 +43,7 @@ jobs:
- name: Build and push - name: Build and push
id: push id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true push: true
@ -68,7 +68,7 @@ jobs:
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Extract tag name - name: Extract tag name
id: tag id: tag

View File

@ -2,9 +2,9 @@ name: CI/CD Pipeline
on: on:
push: push:
branches: [master, develop] branches: [main, develop]
pull_request: pull_request:
branches: [master, develop] branches: [main, develop]
jobs: jobs:
# Security scanning with CodeQL (only on main branch pushes) # Security scanning with CodeQL (only on main branch pushes)
@ -19,15 +19,15 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.12 uses: github/codeql-action/init@v3
with: with:
languages: go languages: go
- name: Setup Go - name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: "1.25" go-version: "1.25"
cache: true cache: true
@ -39,7 +39,7 @@ jobs:
run: go build -v ./... run: go build -v ./...
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.12 uses: github/codeql-action/analyze@v3
# Linting (runs on PRs and pushes) # Linting (runs on PRs and pushes)
lint: lint:
@ -47,16 +47,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Setup Go - name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: "1.25" go-version: "1.25"
cache: true cache: true
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v6.1.1 uses: golangci/golangci-lint-action@v6
with: with:
version: latest version: latest
args: --timeout=5m args: --timeout=5m
@ -87,10 +87,10 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Setup Go - name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: "1.25" go-version: "1.25"
cache: true cache: true
@ -104,7 +104,7 @@ jobs:
go tool cover -html=coverage.out -o coverage.html go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage reports - name: Upload coverage reports
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@v4
with: with:
name: coverage-report name: coverage-report
path: coverage.html path: coverage.html
@ -120,10 +120,10 @@ jobs:
id-token: write id-token: write
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Setup Go - name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: "1.25" go-version: "1.25"
cache: true cache: true
@ -143,7 +143,7 @@ jobs:
run: ./bin/tercul-backend --help || echo "Binary built successfully" run: ./bin/tercul-backend --help || echo "Binary built successfully"
- name: Upload build artifacts - name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@v4
with: with:
name: terbul-backend-binary name: terbul-backend-binary
path: bin/ path: bin/
@ -179,10 +179,10 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Setup Go ${{ matrix.go-version }} - name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
cache: true cache: true

View File

@ -14,10 +14,10 @@ jobs:
security-events: write # For code scanning security-events: write # For code scanning
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.2.0 uses: actions/checkout@v5
- name: Setup Go - name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35 # v5.4.0 uses: actions/setup-go@v5
with: with:
go-version: "1.25" go-version: "1.25"
cache: true cache: true
@ -26,7 +26,7 @@ jobs:
run: go mod download run: go mod download
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v6.1.1 uses: golangci/golangci-lint-action@v6
with: with:
version: latest version: latest
args: --timeout=5m args: --timeout=5m
@ -35,7 +35,7 @@ jobs:
run: go test -v -race -coverprofile=coverage.out ./... run: go test -v -race -coverprofile=coverage.out ./...
- name: Upload coverage - name: Upload coverage
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@v4
with: with:
name: coverage name: coverage
path: coverage.out path: coverage.out