Skip to content

Commit bfce118

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

File tree

1 file changed

+85
-3
lines changed

1 file changed

+85
-3
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ jobs:
9393
aws_region_name: ${{ vars.AWS_REGION_NAME }}
9494
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
9595

96-
# Create a draft release with release message filled in
9796
- name: "Prepare release message"
9897
run: |
9998
cat > release-message <<'EOL'
@@ -103,7 +102,6 @@ jobs:
103102
- name: "Create draft release"
104103
run: echo "RELEASE_URL=$(gh release create ${{ inputs.version }} --target ${{ github.ref_name }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV"
105104

106-
# This step creates the signed release tag
107105
- name: "Create release tag"
108106
uses: mongodb-labs/drivers-github-tools/git-sign@v2
109107
with:
@@ -119,11 +117,95 @@ jobs:
119117
- name: "Push changes from release branch"
120118
run: git push
121119

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

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

0 commit comments

Comments
 (0)