Skip to content

ci(DATAGO-133304): fix concurrency in sam community (#1451) #23

ci(DATAGO-133304): fix concurrency in sam community (#1451)

ci(DATAGO-133304): fix concurrency in sam community (#1451) #23

name: Release Please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
issues: write
checks: write
statuses: write
actions: write
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
environment: release-please
permissions:
contents: read
pull-requests: write
id-token: write
discussions: write
issues: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
release_sha: ${{ steps.release.outputs.sha }}
steps:
- name: Run release-please (release only)
id: release
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ secrets.SAM_RELEASE_PLEASE_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: Add commit author as reviewer on release PR
continue-on-error: true
if: ${{ steps.release.outputs.pr && !steps.release.outputs.release_created }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_PR_JSON: ${{ steps.release.outputs.pr }}
run: |
set -euo pipefail
PR_NUMBER="$(echo "$RELEASE_PR_JSON" | jq -r '.number')"
if [[ -z "$PR_NUMBER" || "$PR_NUMBER" == "null" ]]; then
echo "Could not extract PR number from release-please output, skipping."
exit 0
fi
COMMIT_AUTHOR="$(gh api repos/${{ github.repository }}/commits/${{ github.sha }} --jq '.author.login')"
if [[ -z "$COMMIT_AUTHOR" || "$COMMIT_AUTHOR" == "null" ]]; then
echo "Could not determine commit author for `${{ github.sha }}`, skipping reviewer assignment."
exit 0
fi
echo "Adding `COMMIT_AUTHOR` as reviewer on PR #`PR_NUMBER`"
gh pr edit "$PR_NUMBER" --repo "${{ github.repository }}" --add-reviewer "$COMMIT_AUTHOR" || true
post-process-release:
name: Build and Attach Release Assets
needs: create-release
permissions:
contents: write
pull-requests: write
id-token: write
if: ${{ needs.create-release.outputs.release_created == 'true' }}
uses: ./.github/workflows/release-post-process.yml
with:
release_tag: ${{ needs.create-release.outputs.tag_name }}
secrets: inherit
trigger-publish:
name: Trigger Publish Workflow
needs: [create-release, post-process-release]
if: ${{ needs.create-release.outputs.release_created == 'true' }}
environment: release-please
runs-on: ubuntu-latest
steps:
- name: Dispatch publish workflow and wait
id: publish
uses: SolaceDev/solace-public-workflows/workflow-dispatch-and-wait@main
with:
workflow: publish.yaml
repo: ${{ github.repository }}
ref: main
token: ${{ secrets.SAM_RELEASE_PLEASE_TOKEN }}
wait-for-completion: "true"
wait-for-completion-timeout: "2h"
wait-for-completion-interval: "1m"
workflow-logs: "output"
inputs: >-
{"version":"${{ needs.create-release.outputs.version }}","skip_docker_push":false,"push_latest":true}
- name: Verify publish workflow succeeded
env:
PUBLISH_CONCLUSION: ${{ steps.publish.outputs.workflow-conclusion }}
run: |
if [[ "$PUBLISH_CONCLUSION" != "success" ]]; then
echo "::error::Publish workflow finished with conclusion: ${PUBLISH_CONCLUSION}"
exit 1
fi