Skip to content

Weekly Release

Weekly Release #2

name: Weekly Release
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
check-commits:
runs-on: ubuntu-latest
outputs:
has_commits: ${{ steps.check.outputs.has_commits }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for commits in last 7 days
id: check
run: |
if git log --since="7 days ago" --oneline | grep .; then
echo "has_commits=true" >> $GITHUB_OUTPUT
else
echo "has_commits=false" >> $GITHUB_OUTPUT
fi
release:
needs: check-commits
if: needs.check-commits.outputs.has_commits == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Configure Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Run release-it
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx release-it --ci