Repository navigation
refactor(config): move config loader to ProxyConfig #42
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*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| build: | |
| needs: test # Only build if tests pass | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-latest | |
| use_cross: true | |
| - target: x86_64-pc-windows-gnu | |
| runner: ubuntu-latest | |
| use_cross: true | |
| - target: aarch64-apple-darwin | |
| runner: macos-latest | |
| use_cross: false | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.target }} | |
| - name: Install cross (Ubuntu only) | |
| if: ${{ matrix.use_cross }} | |
| run: cargo install cross | |
| - name: Clean before cross to avoid glibc mix | |
| if: ${{ matrix.use_cross }} | |
| run: cargo clean | |
| - name: Build release binary | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| cross build --locked --release --target ${{ matrix.target }} -v | |
| else | |
| cargo build --locked --release --target ${{ matrix.target }} -v | |
| fi | |
| - name: Package artifact | |
| run: | | |
| mkdir -p dist | |
| BIN=lspdock | |
| EXT="" | |
| ARCHIVE_EXT="tar.gz" | |
| COMPRESS_CMD="tar czf" | |
| if [[ "${{ matrix.target }}" == *windows* ]]; then | |
| EXT=".exe" | |
| ARCHIVE_EXT="zip" | |
| COMPRESS_CMD="zip -r" | |
| fi | |
| cp target/${{ matrix.target }}/release/$BIN$EXT dist/ | |
| pushd dist | |
| eval $COMPRESS_CMD "${BIN}-${{ matrix.target }}.$ARCHIVE_EXT" "$BIN$EXT" | |
| popd | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lspdock-${{ matrix.target }} | |
| path: dist/lspdock-${{ matrix.target }}.* | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Fetch all history for changelog generation | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| # Get the previous tag | |
| PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p') | |
| CURRENT_TAG=${GITHUB_REF#refs/tags/} | |
| # Generate changelog | |
| if [ -z "$PREV_TAG" ]; then | |
| # First release - use all commits | |
| CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges) | |
| else | |
| # Generate changelog between tags | |
| CHANGELOG=$(git log ${PREV_TAG}..${CURRENT_TAG} --pretty=format:"- %s (%h)" --no-merges) | |
| fi | |
| # Create release notes | |
| cat > release_notes.md << EOF | |
| ## What's Changed | |
| ${CHANGELOG} | |
| ## Installation | |
| Download the appropriate binary for your platform: | |
| - **Linux (x86_64)**: \`lspdock-x86_64-unknown-linux-gnu.tar.gz\` | |
| - **Windows (x86_64)**: \`lspdock-x86_64-pc-windows-gnu.zip\` | |
| - **macOS (Apple Silicon)**: \`lspdock-aarch64-apple-darwin.tar.gz\` | |
| Extract and place the binary in your PATH. | |
| **Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${CURRENT_TAG} | |
| EOF | |
| echo "Generated release notes" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/**/* | |
| body_path: release_notes.md | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: false |