Skip to content

ci: add zizmor action with export of security report (#41) #38

ci: add zizmor action with export of security report (#41)

ci: add zizmor action with export of security report (#41) #38

name: Release Please
on:
push:
branches: [main]
permissions: {}
jobs:
release-please:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
pull-requests: write
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
id: release
with:
release-type: python
# Move major version tag (e.g. v1) after a release is cut
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: ${{ steps.release.outputs.release_created }}
with:
persist-credentials: false
- name: Tag major version
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git"
git tag -fa "v${{ steps.release.outputs.major }}" \
-m "Release v${{ steps.release.outputs.tag_name }}"
git push origin "v${{ steps.release.outputs.major }}" --force
- name: Pin README to release SHA
if: ${{ steps.release.outputs.release_created }}
env:
GH_TOKEN: ${{ github.token }}
run: |
sed -i -E \
's|lhoupert/action-python-security-auditing@[^ ]+( # v[0-9][^ ]*)?|lhoupert/action-python-security-auditing@${{ steps.release.outputs.sha }} # ${{ steps.release.outputs.tag_name }}|g' \
README.md
git add README.md
git diff --cached --quiet && echo "README unchanged, skipping commit" && exit 0
BRANCH="chore/pin-readme-${{ steps.release.outputs.tag_name }}"
git checkout -b "$BRANCH"
git commit -m "chore: pin README to ${{ steps.release.outputs.tag_name }}"
git push origin "$BRANCH"
gh pr create \
--title "chore: pin README to ${{ steps.release.outputs.tag_name }}" \
--body "Automated: pin README SHA references to release ${{ steps.release.outputs.tag_name }}." \
--base main \
--head "$BRANCH"
- name: Notify tests repo to update action pin
if: ${{ steps.release.outputs.release_created }}
env:
GH_TOKEN: ${{ secrets.TESTS_REPO_DISPATCH_TOKEN }}
run: |
gh api repos/lhoupert/action-python-security-auditing-tests/dispatches \
--method POST \
-f event_type=action-release \
-F client_payload[sha]='${{ steps.release.outputs.sha }}' \
-F client_payload[tag]='${{ steps.release.outputs.tag_name }}'