ci: replace deprecated softprops/action-gh-release with gh CLI #30
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: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| goos: linux | |
| goarch: amd64 | |
| pkg_deps: libgtk-3-dev libwebkit2gtk-4.1-dev | |
| # macOS disabled (Wails SDK linker issue on ARM runners) | |
| # - os: macos-13 | |
| # goos: darwin | |
| # goarch: amd64 | |
| # pkg_deps: "" | |
| # - os: macos-latest | |
| # goos: darwin | |
| # goarch: arm64 | |
| # pkg_deps: "" | |
| - os: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| pkg_deps: "" | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install system deps | |
| if: matrix.pkg_deps != '' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq ${{ matrix.pkg_deps }} | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26" | |
| cache: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run build | |
| - name: Build with Wails | |
| run: wails build -tags "webkit2_41 desktop production" -ldflags "-s -w -X main.version=${{ github.ref_name }}" | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: ${{ matrix.goarch }} | |
| # nfpm packaging (Linux only) | |
| - name: Install nfpm | |
| if: matrix.goos == 'linux' | |
| run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest | |
| - name: Build nfpm packages | |
| if: matrix.goos == 'linux' | |
| run: | | |
| mkdir -p _packages | |
| # nfpm doesn't expand templates in standalone mode, substitute manually | |
| sed "s/VERSION_PLACEHOLDER/${{ github.ref_name }}/" build/linux/nfpm.yml > /tmp/nfpm.yml | |
| for fmt in deb rpm apk; do | |
| echo "Building $fmt package..." | |
| nfpm package --config /tmp/nfpm.yml --packager "$fmt" && \ | |
| mv -v mdlight* _packages/ 2>/dev/null || \ | |
| echo "Warning: $fmt package failed (continuing)" | |
| done | |
| ls -la _packages/ || echo "No packages built" | |
| - name: Rename binary for release | |
| shell: bash | |
| run: | | |
| ext="" | |
| [ "${{ matrix.goos }}" = "windows" ] && ext=".exe" | |
| mv build/bin/mdlight$ext build/bin/mdlight_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}$ext | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: mdlight-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: | | |
| build/bin/mdlight_* | |
| _packages/* | |
| - name: Upload install script (Linux only) | |
| if: matrix.goos == 'linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: install-script | |
| path: scripts/install.sh | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: _artifacts | |
| - name: Generate checksums | |
| run: | | |
| find _artifacts -type f \( -name 'mdlight_*' -o -name '*.deb' -o -name '*.rpm' -o -name '*.apk' -o -name '*.pkg.tar.*' -o -name 'install.sh' \) -exec sha256sum {} \; > checksums.txt | |
| - name: Create release with gh CLI | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Upload all release assets | |
| gh release create "${{ github.ref_name }}" \ | |
| --title "${{ github.ref_name }}" \ | |
| --notes "See the [commit log](https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}) for details." \ | |
| _artifacts/**/mdlight_* \ | |
| _artifacts/**/*.deb \ | |
| _artifacts/**/*.rpm \ | |
| _artifacts/**/*.apk \ | |
| _artifacts/**/*.pkg.tar.* \ | |
| _artifacts/install-script/install.sh \ | |
| checksums.txt |