Skip to content

Commit 89aed9b

Browse files
committed
Run static analysis on release and publish SSDLC assets
1 parent d450528 commit 89aed9b

File tree

1 file changed

+85
-9
lines changed

1 file changed

+85
-9
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ jobs:
7676
exit 1
7777
fi
7878
79-
- name: "Fail if branch names don't match"
80-
if: ${{ github.ref_name != env.RELEASE_BRANCH }}
81-
run: |
82-
echo '❌ Release failed due to branch mismatch: expected ${{ inputs.version }} to be released from ${{ env.RELEASE_BRANCH }}, got ${{ github.ref_name }}' >> $GITHUB_STEP_SUMMARY
83-
exit 1
84-
8579
#
8680
# Preliminary checks done - commence the release process
8781
#
@@ -93,7 +87,6 @@ jobs:
9387
aws_region_name: ${{ vars.AWS_REGION_NAME }}
9488
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
9589

96-
# Create a draft release with release message filled in
9790
- name: "Prepare release message"
9891
run: |
9992
cat > release-message <<'EOL'
@@ -103,7 +96,6 @@ jobs:
10396
- name: "Create draft release"
10497
run: echo "RELEASE_URL=$(gh release create ${{ inputs.version }} --target ${{ github.ref_name }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV"
10598

106-
# This step creates the signed release tag
10799
- name: "Create release tag"
108100
uses: mongodb-labs/drivers-github-tools/git-sign@v2
109101
with:
@@ -119,11 +111,95 @@ jobs:
119111
- name: "Push changes from release branch"
120112
run: git push
121113

122-
# Pushing the release tag starts build processes that then produce artifacts for the release
123114
- name: "Push release tag"
124115
run: git push origin ${{ inputs.version }}
125116

126117
- name: "Set summary"
127118
run: |
128119
echo '🚀 Created tag and drafted release for version [${{ inputs.version }}](${{ env.RELEASE_URL }})' >> $GITHUB_STEP_SUMMARY
129120
echo '✍️ You may now update the release notes and publish the release when ready' >> $GITHUB_STEP_SUMMARY
121+
122+
static-analysis:
123+
needs: prepare-release
124+
name: "Run Static Analysis"
125+
uses: ./.github/workflows/static-analysis.yml
126+
with:
127+
ref: refs/tags/${{ inputs.version }}
128+
permissions:
129+
security-events: write
130+
id-token: write
131+
132+
publish-ssdlc-assets:
133+
needs: static-analysis
134+
environment: release
135+
name: "Publish SSDLC Assets"
136+
runs-on: ubuntu-latest
137+
permissions:
138+
security-events: read
139+
id-token: write
140+
contents: write
141+
142+
steps:
143+
- name: "Create temporary app token"
144+
uses: actions/create-github-app-token@v1
145+
id: app-token
146+
with:
147+
app-id: ${{ vars.APP_ID }}
148+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
149+
150+
- name: "Store GitHub token in environment"
151+
run: echo "GH_TOKEN=${{ steps.app-token.outputs.token }}" >> "$GITHUB_ENV"
152+
shell: bash
153+
154+
- uses: actions/checkout@v4
155+
with:
156+
ref: refs/tags/${{ inputs.version }}
157+
token: ${{ env.GH_TOKEN }}
158+
159+
- name: "Set up drivers-github-tools"
160+
# TODO: Use main repository when https://github.com/mongodb-labs/drivers-github-tools/pull/25 is merged
161+
uses: blink1073/drivers-github-tools/setup@add-compliance-report
162+
with:
163+
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
164+
aws_region_name: ${{ vars.AWS_REGION_NAME }}
165+
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
166+
167+
- name: "Generate authorized publication document"
168+
uses: mongodb-labs/drivers-github-tools/authorized-pub@v2
169+
with:
170+
product_name: "MongoDB PHP Driver (library)"
171+
release_version: ${{ inputs.version }}
172+
filenames: ""
173+
token: ${{ env.GH_TOKEN }}
174+
175+
# TODO: Currently disabled as the asset group seems to no longer exist?
176+
# - name: "Download SBOM file from Silk"
177+
# uses: mongodb-labs/drivers-github-tools/sbom@v2
178+
# with:
179+
# silk_asset_group: mongodb-php-driver-library
180+
181+
# TODO: Currently disabled as the asset group seems to no longer exist?
182+
# TODO: File name is only correct after https://github.com/mongodb-labs/drivers-github-tools/pull/25 is merged
183+
# - name: "Upload SBOM as release artifact"
184+
# run: gh release upload ${{ inputs.version }} ${{ env.S3_ASSETS }}/cyclonedx.sbom.json
185+
# continue-on-error: true
186+
187+
- name: "Generate SARIF report from code scanning alerts"
188+
# TODO: Use main repository when https://github.com/mongodb-labs/drivers-github-tools/pull/29 is merged
189+
uses: alcaeus/drivers-github-tools/code-scanning-export@document-code-scanning-export
190+
with:
191+
ref: ${{ inputs.version }}
192+
output-file: ${{ env.S3_ASSETS }}/code-scanning-alerts.json
193+
194+
- name: "Generate compliance report"
195+
# TODO: Use main repository when https://github.com/mongodb-labs/drivers-github-tools/pull/25 is merged
196+
uses: blink1073/drivers-github-tools/compliance-report@add-compliance-report
197+
with:
198+
token: ${{ env.GH_TOKEN }}
199+
200+
- name: Upload S3 assets
201+
# TODO: Use main repository when https://github.com/mongodb-labs/drivers-github-tools/pull/30 is merged
202+
uses: alcaeus/drivers-github-tools/upload-s3-assets@upload-s3-assets
203+
with:
204+
version: ${{ inputs.version }}
205+
product_name: mongo-php-library

0 commit comments

Comments
 (0)