Release Obsidian Plugin #73
Workflow file for this run
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: Release Obsidian Plugin | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Release tag to build | |
| required: true | |
| type: string | |
| draft: | |
| description: Create the GitHub Release as a draft | |
| required: false | |
| type: boolean | |
| default: true | |
| prerelease: | |
| description: Mark the GitHub Release as a pre-release | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| - name: Get Version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAG="${{ inputs.tag }}" | |
| DRAFT="${{ inputs.draft }}" | |
| PRERELEASE="${{ inputs.prerelease }}" | |
| else | |
| TAG="${GITHUB_REF_NAME}" | |
| DRAFT="true" | |
| PRERELEASE="false" | |
| fi | |
| echo "tag=${TAG}" >> "${GITHUB_OUTPUT}" | |
| echo "draft=${DRAFT}" >> "${GITHUB_OUTPUT}" | |
| echo "prerelease=${PRERELEASE}" >> "${GITHUB_OUTPUT}" | |
| - name: Validate release files | |
| run: node release-process.mjs validate "${{ steps.version.outputs.tag }}" | |
| - name: Build | |
| id: build | |
| run: | | |
| npm ci | |
| npm run build --if-present | |
| - name: Attest Plugin Artifacts | |
| uses: actions/attest-build-provenance@v4 | |
| with: | |
| subject-path: | | |
| main.js | |
| manifest.json | |
| styles.css | |
| - name: Package | |
| run: | | |
| mkdir ${{ github.event.repository.name }} | |
| cp main.js manifest.json styles.css README.md ${{ github.event.repository.name }} | |
| zip -r ${{ github.event.repository.name }}-${{ steps.version.outputs.tag }}.zip ${{ github.event.repository.name }} | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ github.event.repository.name }}-${{ steps.version.outputs.tag }}.zip | |
| main.js | |
| manifest.json | |
| styles.css | |
| name: ${{ steps.version.outputs.tag }} | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| draft: ${{ steps.version.outputs.draft }} | |
| prerelease: ${{ steps.version.outputs.prerelease }} |