Merge pull request #7 from Validus-Risk-Management/fix-missing-traces… #6
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: | |
| branches: | |
| - main | |
| paths: | |
| - "Cargo.toml" | |
| - ".github/workflows/release.yml" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Install protobuf | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: protoc | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Get version | |
| 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 kcl --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -) >> $GITHUB_ENV | |
| - name: cargo login | |
| if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
| run: cargo login ${{ secrets.CRATES_IO_TOKEN }} | |
| - name: cargo package | |
| if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
| run: | | |
| cargo package | |
| echo "We will publish:" $PACKAGE_VERSION | |
| echo "This is current latest:" $PUBLISHED_VERSION | |
| - name: Publish | |
| if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION | |
| run: | | |
| echo "# Cargo Publish" | |
| cargo publish --no-verify |