add tests, split out logic #21
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 static content to Pages | |
on: | |
push: | |
branches: ["main"] | |
paths-ignore: | |
- "README.md" | |
- "TODO.md" | |
- ".github/ISSUE_TEMPLATE/*" | |
- ".eslintrc.json" | |
- ".gitignore" | |
- ".prettierignore" | |
- ".prettierrc.json" | |
- ".stylelintrc.json" | |
workflow_dispatch: | |
repository_dispatch: | |
types: [update-word-lists] | |
permissions: | |
contents: write # Required for bumping version (read-only required for deployment) | |
pages: write # Required for deployment | |
id-token: write # Required for deployment | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install requirements | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
- name: Setup git config | |
run: | | |
git config --global user.name "skedwards88" | |
git config --global user.email "[email protected]" | |
- name: Bump version | |
run: npm version patch | |
- name: Print packages | |
run: npm list --depth=0 | |
- name: Update word lists | |
run: npm update @skedwards88/word_lists | |
- name: Print packages | |
run: npm list --depth=0 | |
# This keeps package-lock.json up to date with the deployed game | |
- name: Commit the word list update if there are changes to commit | |
run: |- | |
if git diff --exit-code > /dev/null -- package-lock.json; then | |
echo "No changes to commit" | |
else | |
git add package-lock.json | |
git commit -m "Update @skedwards88/word_lists" | |
fi | |
- name: Push the version bump and potential word list update | |
run: | | |
git push | |
- name: Build | |
run: npm run build | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "./dist/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |