From 01e4fe5a1c7c9022fa96f9f824b597b1b4f5176b Mon Sep 17 00:00:00 2001 From: Robert Haimerl Date: Fri, 26 Jul 2024 14:55:57 +0200 Subject: [PATCH] Add alternative GitHub Workflows (#11) * add local analysis and release as github workflows * fix gradle action template --------- Co-authored-by: Robert Haimerl --- .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..f72f2c1 --- /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/actions/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