Skip to content

Commit

Permalink
Merge pull request #317 from acs3ss/official-gh-pages-deployment
Browse files Browse the repository at this point in the history
Switch to official GitHub actions for Pages deploy
  • Loading branch information
winstliu authored Jul 20, 2023
2 parents f1d76e6 + a2a391f commit 018d606
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
Expand Down
43 changes: 32 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
name: Deploy to GitHub Pages
on:
workflow_run:
workflows:
- CI
push:
branches:
- main
types:
- completed

# Allows running manually from the Actions tab
workflow_dispatch:

# Gives enough permissions to 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:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: lts/*
node-version: lts/* # Always use latest LTS
cache: npm

- name: npm ci
Expand All @@ -26,7 +40,14 @@ jobs:
- name: npm run build
run: npm run build

- uses: JamesIves/github-pages-deploy-action@v4
- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
branch: gh-pages
folder: dist
path: dist

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ Two game modes:
1. `npm run dev`
1. Open http://localhost:5173

### Service worker development

The service worker is only included in the production build.
If making changes to the service worker or if you otherwise want to test its functionality,
you'll need to build for production instead and start a separate local server.

1. `npm run build:watch`
1. `npm run serve`
1. Open http://localhost:4173

## Acknowledgements

Card SVGs from https://www.me.uk/cards/ and lightly modified for better Vue templating.
Expand Down

0 comments on commit 018d606

Please sign in to comment.