microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
.github/workflows/publish-playground.yml
70lines · modecode
| 1 | # Largely based on examples at: |
| 2 | # - https://github.com/actions/starter-workflows/blob/main/pages/mdbook.yml |
| 3 | # - https://github.com/actions/starter-workflows/blob/main/pages/static.yml |
| 4 | |
| 5 | name: Publish playground |
| 6 | |
| 7 | on: |
| 8 | push: |
| 9 | branches: [main] |
| 10 | workflow_dispatch: |
| 11 | |
| 12 | env: |
| 13 | CARGO_TERM_COLOR: always |
| 14 | RUST_TOOLCHAIN_VERSION: "1.82" |
| 15 | RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy |
| 16 | |
| 17 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 18 | permissions: |
| 19 | contents: read |
| 20 | pages: write |
| 21 | id-token: write |
| 22 | |
| 23 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 24 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 25 | concurrency: |
| 26 | group: "pages" |
| 27 | cancel-in-progress: false |
| 28 | |
| 29 | jobs: |
| 30 | build: |
| 31 | runs-on: ubuntu-latest |
| 32 | steps: |
| 33 | - uses: actions/checkout@v3 |
| 34 | with: |
| 35 | submodules: "true" |
| 36 | - name: Setup Pages |
| 37 | uses: actions/configure-pages@v3 |
| 38 | - name: Setup rust toolchain |
| 39 | uses: ./.github/actions/toolchains/rust |
| 40 | with: |
| 41 | toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} |
| 42 | components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }} |
| 43 | - uses: actions/setup-python@v4 |
| 44 | with: |
| 45 | python-version: '3.11' |
| 46 | - uses: actions/setup-node@v3 |
| 47 | with: |
| 48 | node-version: '18.17.1' |
| 49 | - uses: Swatinem/rust-cache@v2 |
| 50 | - name: Prereqs |
| 51 | run: python ./prereqs.py --install |
| 52 | - name: Build and Test |
| 53 | run: python ./build.py --no-check --no-test --wasm --npm --play |
| 54 | - name: Upload artifact |
| 55 | uses: actions/upload-pages-artifact@v3 |
| 56 | with: |
| 57 | path: ./playground/public |
| 58 | |
| 59 | deploy: |
| 60 | needs: build |
| 61 | |
| 62 | environment: |
| 63 | name: github-pages |
| 64 | url: ${{ steps.deployment.outputs.page_url }} |
| 65 | |
| 66 | runs-on: ubuntu-latest |
| 67 | steps: |
| 68 | - name: Deploy to GitHub Pages |
| 69 | id: deployment |
| 70 | uses: actions/deploy-pages@v4 |
| 71 | |