diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23d629f3..8bc2370c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,14 @@ jobs: - name: Checkout code uses: actions/checkout@v2 + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} + - name: Set up Java JDK uses: actions/setup-java@v2 with: @@ -34,6 +42,15 @@ jobs: with: fail_ci_if_error: false verbose: true + + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi publish: if: startsWith(github.ref, 'refs/tags/v') @@ -41,6 +58,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + + - name: Setup PMG proxy + id: pmg-setup + uses: safedep/pmg@v1 + with: + server-mode: true + api-key: ${{ secrets.PMG_PUBLIC_REPOS_TOKEN }} + tenant-id: ${{ secrets.PMG_TENANT_ID }} - name: Set up Maven Central Repository uses: actions/setup-java@v2 with: @@ -60,3 +85,12 @@ jobs: env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + + - name: Enforce PMG policy + if: always() + run: | + if [ "${{ steps.pmg-setup.outcome }}" = "success" ]; then + pmg proxy stop --fail-on-violation + else + pmg proxy stop || true + fi