Skip to content

Commit

Permalink
Deploy to surge
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepsteak committed Oct 25, 2024
1 parent 6aa98fa commit 4887eb8
Showing 1 changed file with 28 additions and 32 deletions.
60 changes: 28 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,45 @@ name: Main

on: push

# 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:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: ".nvmrc"
- name: Install
run: npm ci --no-audit --prefer-offline
run: npm ci --prefer-offline --no-audit
- name: Lint
run: npm run lint
- name: Unit test
run: npm test
- name: Build
run: npm run build
- name: Setup Pages
if: contains(github.ref, 'refs/heads/master')
uses: actions/configure-pages@v3
- name: Upload artifact
if: contains(github.ref, 'refs/heads/master')
uses: actions/upload-pages-artifact@v2

deploy:
needs: test
if: github.ref_name == 'master'
concurrency: production
runs-on: ubuntu-latest
environment:
name: production
url: ${{ vars.SURGE_DOMAIN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
# Upload entire repository
path: "dist"
- name: Deploy to GitHub Pages
if: contains(github.ref, 'refs/heads/master')
id: deployment
uses: actions/deploy-pages@v2
cache: npm
node-version-file: ".nvmrc"
- name: Install
run: npm install --prefer-offline --no-audit
- name: Build
run: npm run build
- name: Deploy
run: npx surge ./dist ${{ vars.SURGE_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }}

0 comments on commit 4887eb8

Please sign in to comment.