Continuous Integration / Deployment #253
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: "Continuous Integration / Deployment" | |
on: | |
schedule: | |
- cron: "35 3 * * * " | |
pull_request: | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
- name: Install Dependencies | |
run: npm ci | |
- name: Validate commits with commitlint | |
if: github.event_name == 'pull_request' | |
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
- name: Lint & Build | |
run: npm run tsc && npm run build | |
env: | |
SMITE_DEVELOPER_ID: ${{ secrets.SMITE_DEVELOPER_ID }} | |
SMITE_AUTH_KEY: ${{ secrets.SMITE_AUTH_KEY }} | |
- name: Generate .nojekyll file for _next directory GitHub Pages visibility | |
run: touch out/.nojekyll | |
- name: Unit Tests | |
run: npm test | |
- name: Setup Pages | |
if: github.event_name == 'push' || github.event_name == 'schedule' | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
if: github.event_name == 'push' || github.event_name == 'schedule' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "./out" | |
deploy: | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || github.event_name == 'schedule' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |