-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci!: add automated package release cycle (#329)
- Loading branch information
1 parent
1a2c71d
commit 307738a
Showing
4 changed files
with
82 additions
and
3 deletions.
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,61 @@ | ||
name: Daily Release | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Runs at 00:00 UTC every day. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check for Meaningful Commits | ||
id: check-commits | ||
run: | | ||
LAST_RELEASE_TAG=$(git describe --tags --abbrev=0) | ||
COMMIT_MESSAGES=$(git log $LAST_RELEASE_TAG..HEAD --pretty=format:%s | tr '[:upper:]' '[:lower:]') | ||
if echo "$COMMIT_MESSAGES" | grep -E '^(feat|fix|perf|docs|refactor)'; then | ||
echo "Meaningful changes detected since the last release." | ||
else | ||
echo "No meaningful changes since the last release. Skipping release process." | ||
echo "::set-output name=skip_release::true" | ||
fi | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 'lts/*' | ||
|
||
- name: Install Dependencies | ||
if: steps.check-commits.outputs.skip_release != 'true' | ||
run: yarn install | ||
|
||
- name: Generate Documentation | ||
if: steps.check-commits.outputs.skip_release != 'true' | ||
run: yarn docs | ||
|
||
- name: Build Project | ||
if: steps.check-commits.outputs.skip_release != 'true' | ||
run: yarn build | ||
|
||
- name: Commit Built Files | ||
if: steps.check-commits.outputs.skip_release != 'true' | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
git add -f dist/ | ||
git commit -m "chore: build for release" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run semantic-release | ||
if: steps.check-commits.outputs.skip_release != 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: yarn semantic-release |
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