From 45587028c357ca5352f12072867c00322e80d752 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 10 Aug 2026 20:45:39 +0800 Subject: [PATCH] =?UTF-8?q?config=F0=9F=94=A7:=20CI=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=20Go=20=E7=89=88=E6=9C=AC=E5=B9=B6=E6=9B=B4=E6=96=B0=20Actions?= =?UTF-8?q?=20=E8=87=B3=E6=9C=80=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 8 ++++---- .github/workflows/go.yml | 18 +++++++++++------- .github/workflows/mirror.yaml | 4 ++-- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 534a180f..e159b041 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,12 +16,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: 1.24 + go-version: 1.26.5 - name: Tidy run: go mod tidy @@ -43,7 +43,7 @@ jobs: echo "************ docker push end" - name: Restart server # 第五步,重启服务 - uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0 + uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5 env: GITHUB_SHA_X: ${GITHUB_SHA} with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9bc76722..2997c3fb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,11 +19,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3 + uses: github/codeql-action/init@24c7eb380a2dc368f2d129e4c65e51d172983a1e # v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -34,7 +34,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3 + uses: github/codeql-action/autobuild@24c7eb380a2dc368f2d129e4c65e51d172983a1e # v4 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -48,4 +48,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3 + uses: github/codeql-action/analyze@24c7eb380a2dc368f2d129e4c65e51d172983a1e # v4 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dcd0e1fa..03a3bd6e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,22 +16,26 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.24 - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 + - name: Set up Go 1.26 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: 1.24 + go-version: 1.26.5 id: go - name: Check out code into the Go module directory - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Get dependencies run: go mod tidy - name: Build run: make build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + if: startsWith(${{github.ref}}, 'refs/tags/') + - name: Log in to the Container registry - uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 if: startsWith(${{github.ref}}, 'refs/tags/') with: registry: ${{ env.REGISTRY }} @@ -41,7 +45,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta if: startsWith(${{github.ref}}, 'refs/tags/') - uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: | @@ -52,7 +56,7 @@ jobs: type=sha,prefix=,format=long,enable=true,priority=100 - name: Build and push Docker image - uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3 + uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 if: startsWith(${{github.ref}}, 'refs/tags/') with: context: . diff --git a/.github/workflows/mirror.yaml b/.github/workflows/mirror.yaml index eae1533a..2631e23c 100644 --- a/.github/workflows/mirror.yaml +++ b/.github/workflows/mirror.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: 'Mirror to gitee' uses: pixta-dev/repository-mirroring-action@674e65a7d483ca28dafaacba0d07351bdcc8bd75 # v1 with: @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: 'Mirror to gitlab' uses: pixta-dev/repository-mirroring-action@674e65a7d483ca28dafaacba0d07351bdcc8bd75 # v1 with: