diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9b7e6fa --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: release + +on: + push: + branches: [main] + pull_request: + types: [closed] + branches: [main] + workflow_dispatch: + +permissions: {} + +jobs: + # Parse commits since the last tag, push a `release/vX.Y.Z` branch, and open + # or update a draft release PR covering every publishable workspace package. + pr: + if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: danielroe/uppt/pr@7bcfb5397c37202ef882363f755423130419d28a # v0.5.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + packages: | + packages/* + + # The release PR was merged: tag the squash commit, cut a GitHub release from + # the PR body, and dispatch the publish workflow on the new tag. + release: + if: | + github.event_name == 'pull_request' + && github.event.pull_request.merged == true + && startsWith(github.event.pull_request.head.ref, 'release/v') + && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + concurrency: + group: release-${{ github.event.pull_request.number }} + cancel-in-progress: false + permissions: + contents: write + actions: write + steps: + - uses: danielroe/uppt/release@7bcfb5397c37202ef882363f755423130419d28a # v0.5.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + packages: | + packages/* + + # The chained dispatch lands here on a `vX.Y.Z` tag: install deps, run each + # package's `prepack` build, and pack a tarball per package. + pack: + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + concurrency: + group: pack-${{ github.ref }} + cancel-in-progress: false + permissions: {} + outputs: + files: ${{ steps.pack.outputs.files }} + steps: + - id: pack + uses: danielroe/uppt/pack@7bcfb5397c37202ef882363f755423130419d28a # v0.5.5 + with: + packages: | + packages/* + + # Stage each prebuilt tarball for publish via OIDC trusted publishing. + publish: + if: | + github.event_name == 'workflow_dispatch' + && startsWith(github.ref, 'refs/tags/v') + && needs.pack.outputs.files != '[]' + needs: pack + runs-on: ubuntu-latest + concurrency: + group: publish-${{ github.ref }} + cancel-in-progress: false + permissions: + id-token: write + environment: npm + steps: + - uses: danielroe/uppt/publish@7bcfb5397c37202ef882363f755423130419d28a # v0.5.5 + with: + files: ${{ needs.pack.outputs.files }} diff --git a/packages/nuxt-cos/package.json b/packages/nuxt-cos/package.json index 4829156..3952ba8 100644 --- a/packages/nuxt-cos/package.json +++ b/packages/nuxt-cos/package.json @@ -42,7 +42,7 @@ "build": "nuxt-module-build build", "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare", "lint": "eslint .", - "prepack": "nuxt-module-build build", + "prepack": "pnpm --filter vite-plugin-cross-origin-storage build && nuxt-module-build build", "test": "pnpm test:unit", "test:unit": "vitest run" },