build_publish #21
This file contains hidden or 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: build_publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - src/** | |
| branches: | |
| - master | |
| - beta | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run tests | |
| run: npm run test-coverage:ci | |
| env: | |
| API_BASE_URL: ${{ vars.API_BASE_URL }} | |
| SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }} | |
| TEST_APP_ID: ${{ vars.TEST_APP_ID }} | |
| TEST_APP_IDS: ${{ vars.TEST_APP_IDS }} | |
| TEST_APP_IDS_NO_ACCESS: ${{ vars.TEST_APP_IDS_NO_ACCESS }} | |
| TEST_APP_ID_NO_ACCESS: ${{ vars.TEST_APP_ID_NO_ACCESS }} | |
| TEST_ATTACHMENT: ${{ vars.TEST_ATTACHMENT }} | |
| TEST_ATTACHMENT_FIELD: ${{ vars.TEST_ATTACHMENT_FIELD }} | |
| TEST_ATTACHMENT_FIELD_NO_ACCESS_APP: ${{ vars.TEST_ATTACHMENT_FIELD_NO_ACCESS_APP }} | |
| TEST_ATTACHMENT_FIELD_NO_ACCESS_FIELD: ${{ vars.TEST_ATTACHMENT_FIELD_NO_ACCESS_FIELD }} | |
| TEST_FIELD_ID: ${{ vars.TEST_FIELD_ID }} | |
| TEST_FIELD_IDS: ${{ vars.TEST_FIELD_IDS }} | |
| TEST_FIELD_IDS_NO_ACCESS: ${{ vars.TEST_FIELD_IDS_NO_ACCESS }} | |
| TEST_FIELD_ID_NO_ACCESS: ${{ vars.TEST_FIELD_ID_NO_ACCESS }} | |
| TEST_IMAGE: ${{ vars.TEST_IMAGE }} | |
| TEST_IMAGE_FIELD: ${{ vars.TEST_IMAGE_FIELD }} | |
| TEST_LIST_FIELD: ${{ vars.TEST_LIST_FIELD }} | |
| TEST_LIST_FIELD_NO_ACCESS: ${{ vars.TEST_LIST_FIELD_NO_ACCESS }} | |
| TEST_LIST_ID: ${{ vars.TEST_LIST_ID }} | |
| TEST_LIST_ID_NO_ACCESS: ${{ vars.TEST_LIST_ID_NO_ACCESS }} | |
| TEST_LIST_ITEM_ID_NO_ACCESS: ${{ vars.TEST_LIST_ITEM_ID_NO_ACCESS }} | |
| TEST_RECORD: ${{ vars.TEST_RECORD }} | |
| TEST_REPORT: ${{ vars.TEST_REPORT }} | |
| TEST_REPORT_NO_ACCESS: ${{ vars.TEST_REPORT_NO_ACCESS }} | |
| TEST_REPORT_WITH_CHART_DATA: ${{ vars.TEST_REPORT_WITH_CHART_DATA }} | |
| TEST_SURVEY_AUTO_NUMBER_FIELD: ${{ vars.TEST_SURVEY_AUTO_NUMBER_FIELD }} | |
| TEST_SURVEY_ID: ${{ vars.TEST_SURVEY_ID }} | |
| TEST_SURVEY_RECORD_ID: ${{ vars.TEST_SURVEY_RECORD_ID }} | |
| TEST_TEXT_FIELD: ${{ vars.TEST_TEXT_FIELD }} | |
| - name: Cleanup | |
| run: npm run cleanup | |
| - name: Build ESM | |
| run: npm run build:esm | |
| - name: Build CJS | |
| run: npm run build:cjs | |
| - name: Build package.json | |
| run: npm run build:json | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build | |
| path: ./dist | |
| generate_docs: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate docs | |
| run: npm run generate-docs | |
| - name: Commit generated docs | |
| id: commit | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| commit: --no-verify | |
| message: 'docs: update docs' | |
| committer_name: GitHub Actions | |
| committer_email: [email protected] | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Download build artifact | |
| uses: actions/[email protected] | |
| with: | |
| name: build | |
| path: ./dist | |
| - name: Publish release | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
| run: npx semantic-release |