|
| 1 | +name: Release SBOMs |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + tag: |
| 6 | + description: 'Release tag name' |
| 7 | + required: true |
| 8 | + release: |
| 9 | + types: [released, prereleased] |
| 10 | + |
| 11 | + |
| 12 | +env: |
| 13 | + # The values are extracted from the github.event context, |
| 14 | + # which is only available when the workflow gets triggered by a release event. |
| 15 | + RELEASE_VERSION: ${{ github.event.release.name }} |
| 16 | + BRANCH: ${{ github.event.release.target_commitish }} |
| 17 | + |
| 18 | + |
| 19 | +jobs: |
| 20 | + release-maven: |
| 21 | + if: github.repository_owner == 'Apicurio' && (github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, '3.')) |
| 22 | + runs-on: ubuntu-22.04 |
| 23 | + timeout-minutes: 30 |
| 24 | + env: |
| 25 | + RELEASE_TYPE: release |
| 26 | + steps: |
| 27 | + - name: Fetch Release Details |
| 28 | + if: github.event_name == 'workflow_dispatch' |
| 29 | + run: | |
| 30 | + touch release.json && curl https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.event.inputs.tag }} > release.json |
| 31 | + echo "RELEASE_VERSION=$(cat release.json | jq -r '.name')" >> $GITHUB_ENV |
| 32 | + echo "BRANCH=$(cat release.json | jq -r '.target_commitish')" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - name: Download Source Code |
| 35 | + run: | |
| 36 | + git config --global user.name "apicurio-ci" |
| 37 | + git config --global user.email "apicurio.ci@gmail.com" |
| 38 | + git clone --branch $RELEASE_VERSION --single-branch https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-registry.git registry |
| 39 | +
|
| 40 | + - name: Checkout SBOMs Repo |
| 41 | + run: | |
| 42 | + git config --global user.name "apicurio-ci" |
| 43 | + git config --global user.email "apicurio.ci@gmail.com" |
| 44 | + git clone --branch main --single-branch https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-sboms.git sboms |
| 45 | +
|
| 46 | + - name: Set up JDK 17 |
| 47 | + uses: actions/setup-java@v3 |
| 48 | + with: |
| 49 | + java-version: '17' |
| 50 | + distribution: 'temurin' |
| 51 | + |
| 52 | + - name: Maven Install |
| 53 | + run: | |
| 54 | + cd registry |
| 55 | + mvn install -Pprod -DskipTests -Dspotless.check.skip=true |
| 56 | +
|
| 57 | + - name: Generate Maven SBOMs |
| 58 | + run: | |
| 59 | + mkdir -p sboms/apicurio-registry/$RELEASE_VERSION |
| 60 | + cd registry |
| 61 | + mvn -f app/pom.xml dependency:tree -DoutputType=dot -Dscope=runtime -DoutputFile=../sboms/apicurio-registry/$RELEASE_VERSION/apicurio-registry-app-$RELEASE_VERSION.runtime.sbom.dot |
| 62 | +
|
| 63 | + - name: Generate npm SBOMs |
| 64 | + run: | |
| 65 | + cd registry/ui |
| 66 | + npm install |
| 67 | + cd ui-app |
| 68 | + npm list -prod -depth 10 --json > ../../../sboms/apicurio-registry/$RELEASE_VERSION/apicurio-registry-ui-app-$RELEASE_VERSION.sbom.npm |
| 69 | + cd ../ui-docs |
| 70 | + npm list -prod -depth 10 --json > ../../../sboms/apicurio-registry/$RELEASE_VERSION/apicurio-registry-ui-docs-$RELEASE_VERSION.sbom.npm |
| 71 | +
|
| 72 | + - name: Commit SBOMs to Repo |
| 73 | + run: | |
| 74 | + cd sboms |
| 75 | + git add . |
| 76 | + git commit -m 'Generated SBOMs for release $RELEASE_VERSION' |
| 77 | + git push origin main |
| 78 | +
|
| 79 | + - name: Google Chat Notification |
| 80 | + if: ${{ failure() }} |
| 81 | + uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 |
| 82 | + with: |
| 83 | + name: ${{ github.job }} |
| 84 | + url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} |
| 85 | + status: ${{ job.status }} |
0 commit comments