ci: use git clone instead of actions/checkout (no Node.js needed)

This commit is contained in:
2025-12-11 15:07:36 +01:00
parent baf36760b1
commit d2212ea89c

View File

@@ -8,9 +8,6 @@ on:
pull_request: pull_request:
branches: [main, master] branches: [main, master]
env:
GO_VERSION: '1.23'
jobs: jobs:
test: test:
name: Test name: Test
@@ -18,10 +15,13 @@ jobs:
container: container:
image: golang:1.23-bookworm image: golang:1.23-bookworm
steps: steps:
- name: Install git
run: apt-get update && apt-get install -y git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git config --global --add safe.directory "$GITHUB_WORKSPACE"
fetch-depth: 1 git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
- name: Download dependencies - name: Download dependencies
run: go mod download run: go mod download
@@ -40,10 +40,13 @@ jobs:
container: container:
image: golang:1.23-bookworm image: golang:1.23-bookworm
steps: steps:
- name: Install git
run: apt-get update && apt-get install -y git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git config --global --add safe.directory "$GITHUB_WORKSPACE"
fetch-depth: 1 git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
- name: Install golangci-lint - name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.62.2 run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.62.2
@@ -62,10 +65,13 @@ jobs:
goos: [linux, darwin, windows] goos: [linux, darwin, windows]
goarch: [amd64, arm64] goarch: [amd64, arm64]
steps: steps:
- name: Install git
run: apt-get update && apt-get install -y git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git config --global --add safe.directory "$GITHUB_WORKSPACE"
fetch-depth: 1 git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
- name: Build binary - name: Build binary
env: env:
@@ -86,10 +92,13 @@ jobs:
container: container:
image: golang:1.23-bookworm image: golang:1.23-bookworm
steps: steps:
- name: Install git
run: apt-get update && apt-get install -y git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git config --global --add safe.directory "$GITHUB_WORKSPACE"
fetch-depth: 1 git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
- name: Install Syft - name: Install Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
@@ -107,17 +116,18 @@ jobs:
container: container:
image: golang:1.23-bookworm image: golang:1.23-bookworm
steps: steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install tools - name: Install tools
run: | run: |
apt-get update && apt-get install -y git apt-get update && apt-get install -y git
curl -sSfL https://github.com/goreleaser/goreleaser/releases/download/v2.4.8/goreleaser_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin goreleaser curl -sSfL https://github.com/goreleaser/goreleaser/releases/download/v2.4.8/goreleaser_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin goreleaser
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Checkout code
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git clone --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
git fetch --tags
- name: Run goreleaser - name: Run goreleaser
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}