|
| 1 | +name: Deploy GitHub Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + page-root-directory: |
| 10 | + description: Page root directory |
| 11 | + default: './src/client/' |
| 12 | + type: string |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + pages: write |
| 17 | + id-token: write |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: "pages" |
| 21 | + cancel-in-progress: false |
| 22 | + |
| 23 | +jobs: |
| 24 | + test: |
| 25 | + name: Deno Test |
| 26 | + runs-on: ubuntu-latest |
| 27 | + env: |
| 28 | + deno-version: v1.x |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Get current date |
| 32 | + id: date |
| 33 | + run: echo "DATE=$(date +'%Y.%m.%d@%H-%M-%S')" >> $GITHUB_ENV |
| 34 | + |
| 35 | + - name: Setup Repository (${{github.event.repository.name}}) |
| 36 | + uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Setup Deno (${{env.deno-version}}) |
| 39 | + uses: denoland/setup-deno@v1 |
| 40 | + with: |
| 41 | + deno-version: ${{env.deno-version}} |
| 42 | + |
| 43 | + - name: Run linter |
| 44 | + run: deno lint |
| 45 | + |
| 46 | + - name: Run tests |
| 47 | + if: success() || failure() |
| 48 | + run: | |
| 49 | + mkdir reports |
| 50 | + deno test -A --unstable --check --reload --doc --allow-none --junit-path="./reports/${{env.DATE}}-report.xml" |
| 51 | + |
| 52 | + - name: Report tests (${{env.DATE}}-report.xml) |
| 53 | + uses: dorny/test-reporter@v1 |
| 54 | + with: |
| 55 | + name: Deno Test Report |
| 56 | + path: ./reports/${{env.DATE}}-report.xml |
| 57 | + reporter: jest-junit |
| 58 | + |
| 59 | + deploy: |
| 60 | + name: Deploy Page |
| 61 | + needs: [test] |
| 62 | + env: |
| 63 | + page-root-directory: './src/client/' |
| 64 | + |
| 65 | + runs-on: ubuntu-latest |
| 66 | + steps: |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@v3 |
| 69 | + |
| 70 | + - name: Setup Pages |
| 71 | + uses: actions/configure-pages@v3 |
| 72 | + |
| 73 | + - name: Upload artifact (Automatic) |
| 74 | + if: (!github.event.inputs.page-root-directory) |
| 75 | + uses: actions/upload-pages-artifact@v2 |
| 76 | + with: |
| 77 | + path: ${{env.page-root-directory}} |
| 78 | + |
| 79 | + - name: Upload artifact (Workflow Dispatch) |
| 80 | + if: (github.event.inputs.page-root-directory) |
| 81 | + uses: actions/upload-pages-artifact@v2 |
| 82 | + with: |
| 83 | + path: ${{github.event.inputs.page-root-directory}} |
| 84 | + |
| 85 | + - name: Deploy to GitHub Pages |
| 86 | + id: deployment |
| 87 | + uses: actions/deploy-pages@v2 |
0 commit comments