cached #11
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 website | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint code | |
run: npm run lint | |
- name: Test code | |
run: npm run test | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
outputs: | |
script-file: ${{ steps.publish.outputs.script-file }} | |
steps: | |
- name: Get code | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build website | |
run: npm run build | |
- name: publish JS filename | |
id: publish | |
run: find dist/assets/*.js -type f -execdir echo 'script-file={}' >> $GITHUB_OUTPUT ';' | |
- name: upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-files | |
path: | | |
dist | |
package.json | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-files | |
- name: lists | |
run: ls | |
- name: output finename | |
run: echo ${{ needs.build.outputs.script-file }} | |
- name: Deploy | |
run: echo "Deploying..." |