diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 000000000..e31d7ede0 --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,76 @@ +name: Deploy to GitHub Pages + +on: + workflow_run: + workflows: ["Version Bump"] + types: + - completed + branches: + - main + +permissions: + contents: write + +concurrency: + group: deploy-gh-pages + cancel-in-progress: false + +jobs: + deploy: + environment: Production + runs-on: ubuntu-latest + # Only run if the version-bump workflow succeeded + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.XGH_TOKEN }} + repository: alphahumanxyz/alphahuman + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "yarn" + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build frontend + run: yarn build + env: + NODE_ENV: production + VITE_BACKEND_URL: ${{ vars.VITE_BACKEND_URL }} + VITE_TELEGRAM_BOT_USERNAME: ${{ secrets.VITE_TELEGRAM_BOT_USERNAME }} + VITE_TELEGRAM_BOT_ID: ${{ secrets.VITE_TELEGRAM_BOT_ID }} + VITE_TELEGRAM_API_ID: ${{ secrets.VITE_TELEGRAM_API_ID }} + VITE_TELEGRAM_API_HASH: ${{ secrets.VITE_TELEGRAM_API_HASH }} + VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }} + VITE_SKILLS_GITHUB_REPO: ${{ vars.VITE_SKILLS_GITHUB_REPO }} + VITE_SKILLS_GITHUB_TOKEN: ${{ secrets.VITE_SKILLS_GITHUB_TOKEN }} + VITE_DEBUG: ${{ vars.VITE_DEBUG }} + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + personal_token: ${{ secrets.XGH_TOKEN }} + external_repository: alphahumanxyz/alphahuman + publish_dir: ./deploy + publish_branch: gh-pages + commit_message: "chore: deploy to gh-pages [skip ci]" + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" + + - name: Update GH repo + uses: peaceiris/actions-gh-pages@v4 + with: + personal_token: ${{ secrets.XGH_TOKEN }} + external_repository: alphahumanxyz/alphahuman + publish_dir: ./publish + publish_branch: main + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" + commit_message: "chore: update main branch [skip ci]"