Deploy #144
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'workspaces/**' | |
- '!workspaces/functions/**' | |
workflow_dispatch: | |
env: | |
GENERATED_README_KEY: readme | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.18.1' | |
cache: 'yarn' | |
- name: Install xvfb (Virtual Display) # puppeteer needs that | |
run: sudo apt-get install -y xvfb | |
- name: Install dependencies | |
run: yarn install | |
- name: Generate opengraph | |
run: yarn workspace @teimurjan/website generate-opengraph:ci | |
- name: Generate resume | |
run: yarn workspace @teimurjan/website generate-resume | |
- name: Build | |
run: yarn workspace @teimurjan/website build | |
- name: Generate README | |
run: yarn workspace @teimurjan/profile-readme generate-readme | |
- name: Upload README artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.GENERATED_README_KEY }} | |
path: workspaces/profile-readme/README.md | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./workspaces/website/out | |
deploy-profile: | |
runs-on: ubuntu-20.04 | |
needs: deploy | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- name: Download README artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.GENERATED_README_KEY }} | |
- name: Clone teimurjan repo | |
run: | | |
git clone https://x-access-token:${{ secrets.TEIMURJAN_REPO_TOKEN }}@github.com/teimurjan/teimurjan.git | |
- name: Copy README.md to teimurjan | |
run: | | |
cp workspaces/profile-readme/README.md teimurjan/README.md | |
- name: Commit and push changes to teimurjan | |
working-directory: teimurjan | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add README.md | |
git commit -m "Update README.md content from teimurjan.github.io" || echo "No changes to commit" | |
git push origin HEAD:main |