Publish periodically #2094
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: Publish periodically | |
on: | |
schedule: | |
- cron: '* 18 * * *' # 3:00 AM JST every day | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
- name: Cache node_modules | |
# https://docs.github.com/ja/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action | |
# https://github.com/actions/cache/blob/main/examples.md#macos-and-ubuntu | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: figma | |
run: npm run figma | |
env: | |
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }} | |
FIGMA_FILE_KEY: ${{ secrets.FIGMA_FILE_KEY }} | |
- name: build | |
run: npm run build | |
- name: commit if changed | |
run: | | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "Clean!" | |
exit 1 | |
else | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add --all | |
git commit -m "[CI] Update dist" | |
npm version patch | |
git push origin HEAD | |
git push -f --tags | |
fi |