Release 0.7.0 #4
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Release version without the leading v | |
| required: true | |
| default: 0.6.0 | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| version: | |
| runs-on: windows-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| tag: ${{ steps.version.outputs.tag }} | |
| steps: | |
| - name: Resolve version | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $version = "${{ github.event.inputs.version }}" | |
| if (-not $version) { | |
| $version = "${{ github.ref_name }}".TrimStart("v") | |
| } | |
| "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| "tag=v$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| build: | |
| needs: version | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| - name: Build, verify, and package | |
| shell: pwsh | |
| run: .\gradlew.bat clean check verifyPlugin buildPlugin -PpluginVersion='${{ needs.version.outputs.version }}' -PverifyRecommendedIdes=true --no-daemon --console=plain | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: idea-plugin | |
| path: build/distributions/MarkdownTableEditorIdea-${{ needs.version.outputs.version }}.zip | |
| if-no-files-found: error | |
| release: | |
| needs: | |
| - version | |
| - build | |
| runs-on: windows-latest | |
| steps: | |
| - name: Download package artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| - name: Publish GitHub release | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| TAG_NAME: ${{ needs.version.outputs.tag }} | |
| VERSION: ${{ needs.version.outputs.version }} | |
| run: | | |
| $files = Get-ChildItem -LiteralPath release-assets -Recurse -File -Filter "*.zip" | Sort-Object Name | |
| if (-not $files) { | |
| throw "No release ZIP files were downloaded." | |
| } | |
| $hashPath = Join-Path $PWD "SHA256SUMS.txt" | |
| $hashLines = foreach ($file in $files) { | |
| $hash = (Get-FileHash -Algorithm SHA256 -LiteralPath $file.FullName).Hash.ToLowerInvariant() | |
| "$hash $($file.Name)" | |
| } | |
| [IO.File]::WriteAllLines($hashPath, $hashLines, [Text.UTF8Encoding]::new($false)) | |
| $notesPath = Join-Path $PWD "release-notes.md" | |
| $notes = @( | |
| "## What's Changed", | |
| "", | |
| "- Built the JetBrains IDE plugin package on GitHub Actions.", | |
| "- Updated plugin metadata for version $env:VERSION.", | |
| "- Included SHA-256 sums for release verification.", | |
| "", | |
| "## Validation", | |
| "", | |
| "- GitHub Actions release build completed with smoke tests." | |
| ) | |
| [IO.File]::WriteAllLines($notesPath, $notes, [Text.UTF8Encoding]::new($false)) | |
| $assetPaths = @($files.FullName) + @($hashPath) | |
| gh release view $env:TAG_NAME --repo $env:GITHUB_REPOSITORY *> $null | |
| $releaseExists = $LASTEXITCODE -eq 0 | |
| if ($releaseExists) { | |
| $uploadArgs = @("release", "upload", $env:TAG_NAME) + $assetPaths + @("--repo", $env:GITHUB_REPOSITORY, "--clobber") | |
| & gh @uploadArgs | |
| gh release edit $env:TAG_NAME --repo $env:GITHUB_REPOSITORY --title "Markdown Table Editor $env:VERSION" --notes-file $notesPath --latest | |
| } | |
| else { | |
| $createArgs = @("release", "create", $env:TAG_NAME) + $assetPaths + @("--repo", $env:GITHUB_REPOSITORY, "--target", $env:GITHUB_SHA, "--title", "Markdown Table Editor $env:VERSION", "--notes-file", $notesPath, "--latest") | |
| & gh @createArgs | |
| } |