feat: add common function to extract package name from matchspec (#1923) #953
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: Rust Release | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| # Release unpublished packages. | |
| release-plz-release: | |
| name: Release-plz release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| token: ${{ secrets.RELEASE_PLZ_TOKEN }} | |
| lfs: false | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install Rust toolchain | |
| run: rustup show | |
| - name: Disable LFS globally | |
| # We really don't want to checkout / clone / fetch any LFS files anymore | |
| run: | | |
| # Remove LFS first | |
| git lfs uninstall | |
| sudo apt remove -y git-lfs | |
| # Clean any LFS remnants | |
| rm -rf .git/lfs | |
| rm -rf ~/.git-lfs | |
| # Verify configs are gone | |
| git config --global --list | |
| - name: Run release-plz | |
| uses: release-plz/action@1efcf74dfcd6e500990dad806e286899ae384064 # v0.5 | |
| with: | |
| command: release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| # Create a PR with the new versions and changelog, preparing the next release. | |
| release-plz-pr: | |
| name: Release-plz PR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: release-plz-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| token: ${{ secrets.RELEASE_PLZ_TOKEN }} | |
| lfs: false | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: Install Rust toolchain | |
| run: rustup show | |
| - name: Disable LFS globally | |
| # We really don't want to checkout / clone / fetch any LFS files anymore | |
| run: | | |
| # Remove LFS first | |
| git lfs uninstall | |
| sudo apt remove -y git-lfs | |
| # Clean any LFS remnants | |
| rm -rf .git/lfs | |
| rm -rf ~/.git-lfs | |
| # Verify configs are gone | |
| git config --global --list | |
| - name: Run release-plz | |
| uses: release-plz/action@1efcf74dfcd6e500990dad806e286899ae384064 # v0.5 | |
| id: release-plz | |
| with: | |
| command: release-pr | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Set up pixi | |
| uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7 # v0.9.3 | |
| - name: Update the pixi lock-file | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR: ${{ steps.release-plz.outputs.pr }} | |
| run: | | |
| set -e | |
| pr_number=${{ fromJSON(steps.release-plz.outputs.pr).number }} | |
| if [[ -n "$pr_number" ]]; then | |
| gh pr checkout $pr_number | |
| # Relock the pixi.lock file because it may have changed. | |
| pixi lock | |
| git add . | |
| # Only commit if there are actually changes staged | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Update pixi.lock" | |
| git push | |
| else | |
| echo "No changes to pixi.lock, skipping commit" | |
| fi | |
| fi |