diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index af9d126a..b9937009 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,7 @@ name: CI/CD +permissions: {} + on: pull_request: workflow_dispatch: @@ -7,6 +9,21 @@ on: branches: ["main"] jobs: + zizmor: + name: zizmor + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run zizmor + uses: zizmorcore/zizmor-action@53290badfa369cb0bf7ad16342cb62c2fa47ac7b # v0.8.0 + with: + advanced-security: false # Fail the job on findings instead of uploading SARIF. + annotations: true + ci: name: CI runs-on: ubuntu-latest @@ -15,10 +32,12 @@ jobs: version: [17, 21, 25] steps: - name: Checkout - uses: actions/checkout@v7.0.1 - + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Install java - uses: actions/setup-java@v6.2.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '${{ matrix.version }}' @@ -43,16 +62,17 @@ jobs: name: CD runs-on: ubuntu-latest if: ${{ github.ref_name == 'main' }} - needs: [ci] + needs: [ci, zizmor] permissions: contents: write - actions: write steps: - name: Checkout - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # we need to fetch all existing git tags fetch-depth: 0 + # Required to push release tags from scripts/publish.sh. + persist-credentials: true - name: Create git tags and publish to Maven Central env: diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml index 700e3aac..efc901b7 100644 --- a/.github/workflows/labeler.yaml +++ b/.github/workflows/labeler.yaml @@ -23,7 +23,7 @@ jobs: run: | curl -sSL -o remote-labeler.yml https://raw.githubusercontent.com/stackitcloud/stackit-sdk-go/main/.github/labeler.yml - name: Labeler action - uses: actions/labeler@v7.0.0 + uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 with: configuration-path: "remote-labeler.yml" sync-labels: false diff --git a/scripts/publish.sh b/scripts/publish.sh index 45dd9182..a515cbe0 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -27,7 +27,7 @@ for file in $(find . -print | sed 's|^./||' | grep -E "(^services/[^/]+/VERSION$ # Tag doesn't exist. Create a tag and push it. echo "Tag '$expected_tag' does not exist." git tag -a $expected_tag -m "Release $version" - git push origin tag $expected_tag + git push origin tag "$expected_tag" ./gradlew "${gradle_subproject}:publishToMavenCentral" fi