Add past posts #98
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- run: npm ci | |
- run: npm run build | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist | |
retention-days: 90 | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- run: npm ci | |
- run: npm run lint | |
typecheck: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- run: npm ci | |
- run: npm run typecheck | |
validate-blog: | |
if: startsWith(github.head_ref, 'blog/') | |
needs: [build, lint, typecheck] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- run: npm ci | |
- run: git diff origin/main..HEAD --name-only | xargs npm run validate-blog -- | |
update-blogmeta: | |
needs: [validate-blog] | |
permissions: | |
pages: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- run: npm ci | |
- name: Update blog meta | |
id: update_blogmeta | |
run: | | |
git diff origin/main..HEAD --name-only | xargs npm run update-blogmeta -- | |
echo "{UPDATE_RESULT}_{$?}" >> "$GITHUB_OUTPUT" | |
continue-on-error: true | |
- run: exit ${{ steps.update_blogmeta.outputs.UPDATE_RESULT }} | |
if: steps.update_blogmeta.outputs.UPDATE_RESULT != '1' && steps.update_blogmeta.outputs.UPDATE_RESULT != '0' | |
- name: Git Commit | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "[Bot] Update blog meta" | |
git push origin ${{github.head_ref}} | |
if: steps.update_blogmeta.outputs.UPDATE_RESULT == '0' | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: [build, lint, typecheck] | |
permissions: | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |