From f43bc113e8cd81254d38af1fc60be7be0dbcd41b Mon Sep 17 00:00:00 2001 From: Robert Haimerl Date: Fri, 26 Jul 2024 12:22:28 +0000 Subject: [PATCH 1/4] add local analysis and release as github workflows --- .github/workflows/local-analysis.yaml | 32 ++++++++++++++++++++ .github/workflows/release.yaml | 43 +++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/local-analysis.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/local-analysis.yaml b/.github/workflows/local-analysis.yaml new file mode 100644 index 0000000..5be32c3 --- /dev/null +++ b/.github/workflows/local-analysis.yaml @@ -0,0 +1,32 @@ +name: "Codacy Local Analysis" + +on: push + +jobs: + analyze: + name: analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - uses: gradle/setup-gradle@v3 + with: + gradle-version: 8.9 + - name: build + run: gradle build + - name: generate coverage report + run: gradle jacocoTestReport + - name: uploade coverage data + uses: codacy/codacy-coverage-reporter-action@v1.3.0 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: reports/coverage.xml + - name: generate and upload local analysis data + uses: codacy/codacy-analysis-cli-action@v4.4.5 + with: + tool: spotbugs + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + upload: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..199c2b1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,43 @@ +name: "Release and Attest" + +on: + push: + tags: + - 'v*.*.*' + +jobs: + create-release: + name: create-release + runs-on: ubuntu-latest + permissions: + contents: read + attestations: write + id-token: write + steps: + - uses: actions/checkout@v4 + - name: insert newrelic key + run: sed -i "s||${{ secrets.NEWRELIC_LICENSE_KEY }}|g" newrelic.yml + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + tags: type=semver,pattern={{version}} + images: codingdepot/idp-target-registry + - name: Build and push + id: push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true From f5e0daa4fa0951bfeb1730af7e1a50860c367ca4 Mon Sep 17 00:00:00 2001 From: Robert Haimerl Date: Fri, 26 Jul 2024 12:27:57 +0000 Subject: [PATCH 2/4] fix gradle action template --- .github/workflows/local-analysis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/local-analysis.yaml b/.github/workflows/local-analysis.yaml index 5be32c3..f72f2c1 100644 --- a/.github/workflows/local-analysis.yaml +++ b/.github/workflows/local-analysis.yaml @@ -12,7 +12,7 @@ jobs: with: distribution: temurin java-version: 17 - - uses: gradle/setup-gradle@v3 + - uses: gradle/actions/setup-gradle@v3 with: gradle-version: 8.9 - name: build From 2e225117b49aa8e7ec4e1cc02d641014c74aed18 Mon Sep 17 00:00:00 2001 From: Robert Haimerl Date: Fri, 26 Jul 2024 12:59:41 +0000 Subject: [PATCH 3/4] update workflow files --- .github/workflows/local-analysis.yaml | 5 ++++- .github/workflows/release.yaml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/local-analysis.yaml b/.github/workflows/local-analysis.yaml index f72f2c1..f404e8c 100644 --- a/.github/workflows/local-analysis.yaml +++ b/.github/workflows/local-analysis.yaml @@ -1,6 +1,9 @@ name: "Codacy Local Analysis" -on: push +on: + push: + tags-ignore: + - '**' jobs: analyze: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 199c2b1..d7fefbe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: codingdepot password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta From c595ce95b035a0466aaf31ef1efde476b4603e11 Mon Sep 17 00:00:00 2001 From: Robert Haimerl Date: Fri, 26 Jul 2024 13:11:50 +0000 Subject: [PATCH 4/4] more workflow improvements --- .github/workflows/local-analysis.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/local-analysis.yaml b/.github/workflows/local-analysis.yaml index f404e8c..7bc4d94 100644 --- a/.github/workflows/local-analysis.yaml +++ b/.github/workflows/local-analysis.yaml @@ -2,7 +2,7 @@ name: "Codacy Local Analysis" on: push: - tags-ignore: + branches: - '**' jobs: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d7fefbe..ceebab8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -38,6 +38,6 @@ jobs: - name: Generate artifact attestation uses: actions/attest-build-provenance@v1 with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-name: codingdepot/idp-target-registry subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true