Release plz action: install required dependencies (#85) #6
This file contains 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-plz | |
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 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: apt install -y protobuf-compiler libprotobuf-dev | |
- name: Run release-plz | |
uses: MarcoIeni/[email protected] | |
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 | |
concurrency: | |
group: release-plz-${{ github.ref }} | |
cancel-in-progress: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Close old release PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# List all opened PRs which head branch starts with "release-plz-" | |
release_pr=$(gh pr list --state='open' --json number,headRefName --jq '.[] | select(.headRefName | startswith("release-plz-")) | .number') | |
# Close the release PR if there is one | |
if [[ -n "$release_pr" ]]; then | |
echo "Closing old release PR $release_pr" | |
gh pr close $release_pr | |
else | |
echo "No open release PR" | |
fi | |
- name: Run release-plz | |
uses: MarcoIeni/[email protected] | |
with: | |
command: release-pr | |
config: .release-plz.toml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |