test: auto deploy #240
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: Deploy Site | ||
on: | ||
push: | ||
branches: ["main"] | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
jobs: | ||
# Single deploy job since we're just deploying | ||
build: | ||
name: 'Build the images to publish' | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cache Public | ||
id: cache-public | ||
uses: actions/cache@v4 | ||
with: | ||
path: public | ||
key: public-7-${{ github.run_id }} # Can use time based key as well | ||
restore-keys: | | ||
public-7 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- run: mkdir -p public; cp survey_statistics.json public/survey_statistics | ||
- run: npm ci | ||
working-directory: scripts/build | ||
- run: npm start | ||
working-directory: scripts/build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: 'public' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
- run: | | ||
gh workflow run deploy.yml -R owddm/owddm.github.io | ||
with: | ||
github_token: ${{ secrets.DEPLOY_GITHUB_TOKEN }} |