Skip to content

Commit b95d53d

Browse files
committed
chore(ci): add gha linter (zizmore) and fix issues
- pin each action to hash - use persist-credentials: false on checkout actions - scope GITHUB_TOKEN to create git tags step STACKITSDK-614
1 parent 321ba83 commit b95d53d

3 files changed

Lines changed: 27 additions & 7 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: CI/CD
22

3+
permissions: {}
4+
35
on:
46
pull_request:
57
workflow_dispatch:
@@ -15,10 +17,12 @@ jobs:
1517
version: [17, 21, 25]
1618
steps:
1719
- name: Checkout
18-
uses: actions/checkout@v7.0.1
19-
20+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21+
with:
22+
persist-credentials: false
23+
2024
- name: Install java
21-
uses: actions/setup-java@v6.1.0
25+
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
2226
with:
2327
distribution: 'temurin'
2428
java-version: '${{ matrix.version }}'
@@ -39,27 +43,42 @@ jobs:
3943
- name: Publish to local maven repo
4044
run: make install
4145

46+
zizmor:
47+
name: zizmor
48+
runs-on: ubuntu-latest
49+
permissions:
50+
security-events: write
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
54+
with:
55+
persist-credentials: false
56+
57+
- name: Run zizmor
58+
uses: zizmorcore/zizmor-action@53290badfa369cb0bf7ad16342cb62c2fa47ac7b # v0.8.0
59+
4260
cd:
4361
name: CD
4462
runs-on: ubuntu-latest
4563
if: ${{ github.ref_name == 'main' }}
4664
needs: [ci]
4765
permissions:
4866
contents: write
49-
actions: write
5067
steps:
5168
- name: Checkout
52-
uses: actions/checkout@v7.0.1
69+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5370
with:
5471
# we need to fetch all existing git tags
5572
fetch-depth: 0
73+
persist-credentials: false
5674

5775
- name: Create git tags and publish to Maven Central
5876
env:
5977
GPG_SIGNING_KEY: "${{ secrets.GPG_SIGNING_KEY }}"
6078
GPG_SIGNING_PASSWORD: "${{ secrets.GPG_SIGNING_PASSWORD }}"
6179
ORG_GRADLE_PROJECT_mavenCentralUsername: "${{ secrets.MAVEN_CENTRAL_USERNAME }}"
6280
ORG_GRADLE_PROJECT_mavenCentralPassword: "${{ secrets.MAVEN_CENTRAL_PASSWORD }}"
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6382
run: |
6483
git config --global user.name "SDK Releaser Bot"
6584
git config --global user.email "noreply@stackit.de"

‎.github/workflows/labeler.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: |
2424
curl -sSL -o remote-labeler.yml https://raw.githubusercontent.com/stackitcloud/stackit-sdk-go/main/.github/labeler.yml
2525
- name: Labeler action
26-
uses: actions/labeler@v7.0.0
26+
uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
2727
with:
2828
configuration-path: "remote-labeler.yml"
2929
sync-labels: false

‎scripts/publish.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ for file in $(find . -print | sed 's|^./||' | grep -E "(^services/[^/]+/VERSION$
2727
# Tag doesn't exist. Create a tag and push it.
2828
echo "Tag '$expected_tag' does not exist."
2929
git tag -a $expected_tag -m "Release $version"
30-
git push origin tag $expected_tag
30+
auth_header=$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 -w0)
31+
git -c http.extraheader="AUTHORIZATION: basic $auth_header" push origin tag "$expected_tag"
3132

3233
./gradlew "${gradle_subproject}:publishToMavenCentral"
3334
fi

0 commit comments

Comments
 (0)