name: Create Plugin Release on: push: # Sequence of patterns matched against refs/tags tags: - '*' # Push events to matching any tag format, i.e. 1.0, 20.15.10 env: PLUGIN_NAME: media-db-sync # Change this to the name of your plugin-id folder jobs: build: runs-on: ubuntu-latest permissions: contents: write id-token: write attestations: write steps: - name: Checkout uses: actions/checkout@v6 - name: Determine prerelease status id: status run: | # Any semver prerelease tag (0.1.0-beta.1, 0.8.0-canary.x, 1.0.0-rc.1) ships as a prerelease. if [[ "${{ github.ref_name }}" == *"-"* ]]; then echo "prerelease=true" >> $GITHUB_OUTPUT else echo "prerelease=false" >> $GITHUB_OUTPUT fi - name: Install Bun uses: oven-sh/setup-bun@v2 with: bun-version: latest - name: Build id: build env: TAG: ${{ github.ref_name }} run: | bun install --frozen-lockfile bun run build # BRAT resolves the tag from manifest-beta.json, then installs the manifest.json # shipped in that release. On a prerelease tag the two must agree, or BRAT reads # back a different version than it installed and re-downloads forever. if [[ "$TAG" == *"-"* ]]; then cp manifest-beta.json dist/manifest.json fi mkdir ${{ env.PLUGIN_NAME }} cp dist/main.js dist/manifest.json dist/styles.css ${{ env.PLUGIN_NAME }} zip -r ${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip ${{ env.PLUGIN_NAME }} ls - name: Attest build provenance uses: actions/attest@v4 with: subject-path: | dist/main.js dist/manifest.json dist/styles.css ${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip - name: Release id: release uses: softprops/action-gh-release@v3 with: prerelease: ${{ steps.status.outputs.prerelease }} token: ${{ secrets.GITHUB_TOKEN }} files: | ${{ env.PLUGIN_NAME }}-${{ github.ref_name }}.zip dist/main.js dist/manifest.json dist/styles.css