diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb3d94f..82d05c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,30 +2,15 @@ name: CI on: push: + branches: [main] pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: - test: - if: >- - github.event_name != 'pull_request' || - github.event.pull_request.head.repo.full_name != github.repository || - github.event.pull_request.user.login == 'github-actions[bot]' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - - run: npm ci - - run: npm run lint - - run: npm run typecheck - - run: npm run test - - run: npm run build + ci: + uses: maptoolkit/.github/.github/workflows/npm-ci.yml@main + permissions: + contents: read diff --git a/.github/workflows/deploy_pages.yaml b/.github/workflows/deploy-pages.yml similarity index 85% rename from .github/workflows/deploy_pages.yaml rename to .github/workflows/deploy-pages.yml index 6b9ade8..2d4bd8f 100644 --- a/.github/workflows/deploy_pages.yaml +++ b/.github/workflows/deploy-pages.yml @@ -2,9 +2,7 @@ name: Deploy demo to GitHub Pages on: workflow_dispatch: - push: - tags: - - "v*" + workflow_call: permissions: id-token: write @@ -25,8 +23,6 @@ jobs: cache: npm - run: npm ci - run: npm run build:demo - env: - VITE_MAPTOOLKIT_API_KEY: ${{ secrets.MAPTOOLKIT_API_KEY }} - uses: actions/configure-pages@v5 - uses: actions/upload-pages-artifact@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61eab28..f155917 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,35 +8,18 @@ concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: release: - runs-on: ubuntu-latest + uses: maptoolkit/.github/.github/workflows/npm-release.yml@main permissions: contents: write pull-requests: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - registry-url: https://registry.npmjs.org - - run: npm ci - - name: Create release PR or publish to npm - uses: changesets/action@v1 - with: - publish: npm run release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Push release tags and create GitHub releases - run: | - tags=$(git tag --points-at HEAD) - if [ -n "$tags" ]; then - git push origin --tags - for tag in $tags; do - gh release create "$tag" --title "$tag" --generate-notes - done - fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + secrets: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + deploy-pages: + needs: release + if: needs.release.outputs.published == 'true' + uses: ./.github/workflows/deploy-pages.yml + permissions: + id-token: write + pages: write + contents: read