ci: setup release pipeline (#5) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check_commit_message: | |
runs-on: ubuntu-latest | |
outputs: | |
patternMatch: ${{ steps.check_pattern.outputs.match }} | |
isReleaseComplete: ${{ steps.check_pattern.outputs.release_complete }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for release pattern in commit message | |
id: check_pattern | |
run: | | |
PATTERN="Release-As: [0-9]+\.[0-9]+\.[0-9]+|release [0-9]+\.[0-9]+\.[0-9]+" | |
COMMIT_MESSAGE=$(git log --format=%B -n 1) | |
echo "Commit Message: $COMMIT_MESSAGE" | |
if [[ "$COMMIT_MESSAGE" =~ $PATTERN ]]; then | |
echo "Pattern found. Proceeding with the job." | |
echo "::set-output name=match::true" | |
else | |
echo "Pattern not found. Skipping subsequent steps." | |
echo "::set-output name=match::false" | |
fi | |
PATTERN="release [0-9]+\.[0-9]+\.[0-9]+" | |
COMMIT_MESSAGE=$(git log --format=%B -n 1) | |
echo "Commit Message: $COMMIT_MESSAGE" | |
if [[ "$COMMIT_MESSAGE" =~ $PATTERN ]]; then | |
echo "Pattern found. Proceeding with the job." | |
echo "::set-output name=release_complete::true" | |
else | |
echo "Pattern not found. Skipping subsequent steps." | |
echo "::set-output name=release_complete::false" | |
fi | |
release-please: | |
needs: check_commit_message | |
runs-on: ubuntu-latest | |
if: needs.check_commit_message.outputs.patternMatch == 'true' | |
steps: | |
- uses: google-github-actions/release-please-action@v4 | |
with: | |
release-type: node | |
trigger-publish-dispatch: | |
name: "Trigger Publish Repository Dispatch Event" | |
needs: [release-please, check_commit_message] | |
runs-on: ubuntu-latest | |
if: needs.check_commit_message.outputs.isReleaseComplete == 'true' | |
steps: | |
- name: Create Release Repository Dispatch Event | |
id: create_release_dispatch | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
event-type: publish-new-version |