Merge branch 'master' into release #272
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 | |
on: | |
push: | |
branches: | |
- release | |
paths: | |
- "**/Cargo.toml" | |
- ".github/workflows/release.yml" | |
jobs: | |
publish: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
package: | |
- name: poem-derive | |
registryName: poem-derive | |
path: poem-derive | |
- name: poem | |
registryName: poem | |
path: poem | |
- name: poem-lambda | |
registryName: poem-lambda | |
path: poem-lambda | |
- name: poem-openapi-derive | |
registryName: poem-openapi-derive | |
path: poem-openapi-derive | |
- name: poem-openapi | |
registryName: poem-openapi | |
path: poem-openapi | |
- name: poem-grpc-build | |
registryName: poem-grpc-build | |
path: poem-grpc-build | |
- name: poem-grpc | |
registryName: poem-grpc | |
path: poem-grpc | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Protoc | |
if: matrix.package.name == 'poem-grpc' || matrix.package.name == 'poem-openapi' | |
uses: arduino/setup-protoc@v1 | |
- name: Get Version | |
working-directory: ${{ matrix.package.path }} | |
run: echo PACKAGE_VERSION=$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml) >> $GITHUB_ENV | |
- name: Check Published Version | |
run: echo PUBLISHED_VERSION=$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV | |
- name: Cargo Login | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
run: cargo login ${{ secrets.CRATES_TOKEN }} | |
- name: Cargo Package | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
working-directory: ${{ matrix.package.path }} | |
run: | | |
cargo package | |
echo "We will publish:" $PACKAGE_VERSION | |
echo "This is current latest:" $PUBLISHED_VERSION | |
- name: Publish ${{ matrix.package.name }} | |
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
working-directory: ${{ matrix.package.path }} | |
run: | | |
echo "# Cargo Publish" | |
cargo publish --no-verify |