-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release-As: 0.0.1
- Loading branch information
Showing
3 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Publish package to npm | ||
|
||
on: | ||
repository_dispatch: | ||
types: [publish-new-version] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.0" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint | ||
- name: Run tests | ||
run: npm run test | ||
env: | ||
VITE_CLARIFAI_USER_ID: ${{ secrets.VITE_CLARIFAI_USER_ID }} | ||
VITE_CLARIFAI_PAT: ${{ secrets.VITE_CLARIFAI_PAT }} | ||
- name: Build | ||
run: npm run build | ||
- name: Publish to npm | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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 |