Daily Release #350
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: 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: Setup Node.js (LTS) | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 'lts/*' # Use the latest LTS version of Node.js | |
- name: Install Dependencies | |
run: yarn install | |
- name: Generate Documentation | |
run: yarn docs | |
- name: Build Project | |
run: yarn build | |
- name: Commit Built Files and Documentation | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add . # Add all files, including documentation | |
git commit -m "chore: build and documentation for release" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run semantic-release | |
run: | | |
maxRetry=3 | |
delay=60 | |
for attempt in $(seq 1 $maxRetry); do | |
if yarn semantic-release; then | |
break | |
elif [ $attempt -lt $maxRetry ]; then | |
echo "Attempt $attempt failed. Retrying in $delay seconds..." | |
sleep $delay | |
else | |
echo "All attempts failed." | |
exit 1 | |
fi | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |