|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - "v*" |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +env: |
| 12 | + NODE_VERSION: "22" |
| 13 | + |
| 14 | +jobs: |
| 15 | + lint_and_test: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + - name: Install Node.js |
| 20 | + uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version: ${{ env.NODE_VERSION }} |
| 23 | + - name: Install Dependencies |
| 24 | + shell: bash |
| 25 | + run: npm install |
| 26 | + - name: Run prettier check |
| 27 | + shell: bash |
| 28 | + run: npm run fmt-check |
| 29 | + - name: Install latest Spin CLI |
| 30 | + uses: fermyon/actions/spin/setup@v1 |
| 31 | + with: |
| 32 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + - name: Run Test |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + cd test |
| 37 | + ./test.sh |
| 38 | + |
| 39 | + test_template: |
| 40 | + runs-on: ${{ matrix.os }} |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 44 | + steps: |
| 45 | + - name: Checkout Repository |
| 46 | + uses: actions/checkout@v3 |
| 47 | + - name: Install Node.js |
| 48 | + uses: actions/setup-node@v3 |
| 49 | + with: |
| 50 | + node-version: ${{ env.NODE_VERSION }} |
| 51 | + - name: Install latest Spin CLI |
| 52 | + uses: fermyon/actions/spin/setup@v1 |
| 53 | + with: |
| 54 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + - name: Install templates |
| 56 | + run: spin templates install --dir . |
| 57 | + - name: Create new project |
| 58 | + run: spin new -t http-ts test-project -a |
| 59 | + - name: Install dependencies of the test project |
| 60 | + run: | |
| 61 | + cd test-project |
| 62 | + npm install |
| 63 | + - name: Add new component to project |
| 64 | + run: | |
| 65 | + cd test-project |
| 66 | + spin add -t http-ts new-component -a |
| 67 | + cd new-component |
| 68 | + npm install |
| 69 | + - name: Build the application |
| 70 | + run: | |
| 71 | + cd test-project |
| 72 | + spin build |
| 73 | + build_docs: |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: lint_and_test # later we want this after publishing to npmjs |
| 76 | + steps: |
| 77 | + - name: Checkout Repository including Tags |
| 78 | + uses: actions/checkout@v4 |
| 79 | + - name: Fetch Git tags |
| 80 | + run: git fetch --tags |
| 81 | + - name: Install Node.js |
| 82 | + uses: actions/setup-node@v3 |
| 83 | + with: |
| 84 | + node-version: ${{ env.NODE_VERSION }} |
| 85 | + - name: Generate Spin JS SDK Docs |
| 86 | + run: | |
| 87 | + ./scripts/build-docs.sh |
| 88 | + - name: Upload Spin JS SDK Docs as Artifact |
| 89 | + id: docs_deployment |
| 90 | + uses: actions/upload-pages-artifact@v3 |
| 91 | + with: |
| 92 | + path: docs/ |
| 93 | + deploy_docs: |
| 94 | + if: (startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch') |
| 95 | + permissions: |
| 96 | + pages: write |
| 97 | + environment: |
| 98 | + name: github-pages |
| 99 | + url: ${{ steps.docs_deployment.outputs.page_url }} |
| 100 | + runs-on: ubuntu-latest |
| 101 | + needs: build_docs |
| 102 | + steps: |
| 103 | + - name: Deploy to GitHub Pages |
| 104 | + id: docs_deployment |
| 105 | + uses: actions/deploy-pages@v4 |
0 commit comments