From 710d926f5d3395d684534269c664dc96f97c9d24 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Mon, 14 Oct 2024 09:50:41 +0200 Subject: [PATCH] ci: add publish dependencies flow --- .github/workflows/publish-dependencies.yml | 64 ++++++++++++++++++++++ .github/workflows/verify-openapi.yml | 6 +- 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish-dependencies.yml diff --git a/.github/workflows/publish-dependencies.yml b/.github/workflows/publish-dependencies.yml new file mode 100644 index 0000000..81d7ece --- /dev/null +++ b/.github/workflows/publish-dependencies.yml @@ -0,0 +1,64 @@ +name: publish dependencies + +on: + workflow_call: + +jobs: + publish-dependencies: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: eclipse-edc/.github/.github/actions/setup-build@main + - name: Download latest Eclipse Dash + run: | + curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar + - name: Generate DEPENDENCIES + run: | + ./gradlew allDependencies | grep -Poh "(?<=\s)[\w.-]+:[\w.-]+:[^:\s\[\]]+" | sort | uniq | java -jar dash.jar - -summary DEPENDENCIES || true + + - name: evaluate DEPENDENCIES + run: | + if ! [ -s DEPENDENCIES ]; + then + echo "error: DEPENDENCIES file was not created correctly, please trigger the workflow again"; + exit 1; + fi + + grep -q "restricted" DEPENDENCIES > RESTRICTED; + if [ -s RESTRICTED ]; + then + echo "warning: restricted dependencies found:"; + cat RESTRICTED; + fi + + grep -q "rejected" DEPENDENCIES > REJECTED; + if [ -s REJECTED ]; + then + echo "error: rejected dependencies found:"; + cat REJECTED; + exit 1; + fi + + - name: prepare deploy + run: | + mkdir public + mv DEPENDENCIES public/ + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: public + keep_files: true + + Post-To-Discord: + needs: [ publish-dependencies ] + if: "failure()" + runs-on: ubuntu-latest + steps: + - uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_GITHUB_CI_WEBHOOK }} + status: ${{ needs.publish-dependencies.result }} + title: "Generate ${{ github.repository }} dependencies" + username: GitHub Actions diff --git a/.github/workflows/verify-openapi.yml b/.github/workflows/verify-openapi.yml index 5a3792f..2ab34ae 100644 --- a/.github/workflows/verify-openapi.yml +++ b/.github/workflows/verify-openapi.yml @@ -57,7 +57,7 @@ jobs: diff ${{ matrix.apiGroup }}.yaml ${{ matrix.apiGroup }}-new.yaml > diff if [ -s diff ]; then - echo "${{ matrix.apiGroup }} openapi spec diverges from the published one, please update the version.json file" - cat diff - exit 1 + echo "${{ matrix.apiGroup }} openapi spec diverges from the published one, please update the version.json file"; + cat diff; + exit 1; fi