chore: Release version v0.0.30 #812
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: Semver checks | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| RUSTDOCFLAGS: '--deny warnings' | |
| MINIMUM_SUPPORTED_RUST_VERSION: 1.85.0 | |
| RUST_CHANNEL: stable | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| branches: | |
| - main | |
| paths-ignore: | |
| - CHANGELOG.md | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-branches: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: you can't run this action on 'main' branch | |
| run: | | |
| if [[ "${REF_NAME}" = "main" ]]; then | |
| exit 1 | |
| fi | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| setup: | |
| needs: check-branches | |
| outputs: | |
| currentVersion: ${{ steps.current.outputs.version }} | |
| nextVersion: ${{ steps.next.outputs.version }} | |
| nextStep: ${{ steps.nextStep.outputs.nextStep }} | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Delete old cargo-semver-checks comments | |
| continue-on-error: true | |
| run: | | |
| gh pr view "${{ github.event.number }}" --json comments --jq '.comments[] | select(.author.login == "github-actions") | .url' | grep -E 'issuecomment-(.+)' | cut -d '-' -f2 > comments.txt | |
| xargs -I {} gh api -X DELETE "/repos/${{ github.repository }}/issues/comments/{}" < comments.txt | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install Rust | |
| run: | | |
| rustup update --no-self-update ${RUST_CHANNEL} | |
| rustup component add --toolchain ${RUST_CHANNEL} cargo | |
| rustup default ${RUST_CHANNEL} | |
| env: | |
| RUST_CHANNEL: ${{ env.RUST_CHANNEL }} | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 | |
| - name: List the releases on GitHub | |
| id: current | |
| run: echo "version=$(git tag --sort=-creatordate | head -n 1)" >> "$GITHUB_OUTPUT" | |
| - name: Get next version | |
| id: next | |
| run: echo "version=v$(cargo pkgid --manifest-path crates/bin/Cargo.toml | cut -d '@' -f2)" >> "$GITHUB_OUTPUT" | |
| - name: Compute next step | |
| id: nextStep | |
| if: ${{ steps.current.outputs.version == steps.next.outputs.version }} | |
| run: | | |
| if [[ "${CURRENT_VERSION}" == "${NEXT_VERSION}" ]]; then | |
| echo "nextStep=compute" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "nextStep=nope" >> "$GITHUB_OUTPUT" | |
| fi | |
| env: | |
| CURRENT_VERSION: ${{ steps.current.outputs.version }} | |
| NEXT_VERSION: ${{ steps.next.outputs.version }} | |
| cargo-semver-checks: | |
| needs: setup | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.setup.outputs.nextStep != 'compute' }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Install Rust | |
| run: | | |
| rustup update --no-self-update ${RUST_CHANNEL} | |
| rustup component add --toolchain ${RUST_CHANNEL} cargo | |
| rustup default ${RUST_CHANNEL} | |
| env: | |
| RUST_CHANNEL: ${{ env.RUST_CHANNEL }} | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 | |
| - name: Install cargo-semver-checks | |
| run: cargo install --locked cargo-semver-checks | |
| - name: Show release type | |
| id: semver | |
| run: | | |
| echo "release=$(bash ./.github/workflows/semver.sh diff ${CURRENT_VERSION} ${NEXT_VERSION})" >> "$GITHUB_OUTPUT" | |
| env: | |
| CURRENT_VERSION: ${{ needs.setup.outputs.currentVersion }} | |
| NEXT_VERSION: ${{ needs.setup.outputs.nextVersion }} | |
| - name: Prepare report.md | |
| run: | | |
| { | |
| printf "> [!WARNING]" | |
| printf "> According to \`cargo-semver-checks\`, the next release version doesn\'t respect semantic versioning." | |
| printf '```bash' | |
| } > ./report.md | |
| - run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev | |
| - name: Run cargo semver-checks | |
| id: check | |
| run: | | |
| printf "\`cargo-semver-checks\` has detected some issues: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n" > report.md | |
| printf '```bash' >> report.md | |
| RUSTFLAGS="--cfg tokio_unstable" cargo semver-checks --color never --package yozefu-lib --package yozefu-app --package yozefu-wasm-types --package yozefu-command --baseline-rev "${CURRENT_VERSION}" --release-type "${RELEASE_TYPE}" 2>&1 | tee -a report.md | |
| if [[ "${PIPESTATUS[0]}" != "0" ]]; then | |
| printf '```' >> report.md | |
| exit 1 | |
| fi | |
| env: | |
| CURRENT_VERSION: ${{ needs.setup.outputs.currentVersion }} | |
| RUST_CHANNEL: ${{ env.RUST_CHANNEL }} | |
| RELEASE_TYPE: ${{ steps.semver.outputs.release }} | |
| continue-on-error: true | |
| - name: Publish semver-checks report | |
| if: ${{ steps.check.outcome != 'success' }} | |
| run: | | |
| gh pr comment ${{ github.event.number }} --body-file ./report.md | |
| exit 1 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish semver-checks report | |
| if: ${{ steps.check.outcome != 'success' }} | |
| run: | | |
| gh pr comment ${{ github.event.number }} --body-file ./report.md | |
| exit 1 | |
| compute-next-version: | |
| needs: setup | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| if: ${{ needs.setup.outputs.nextStep == 'compute' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - run: | | |
| rustup update --no-self-update ${RUST_CHANNEL} | |
| rustup component add --toolchain ${RUST_CHANNEL} cargo | |
| rustup default ${RUST_CHANNEL} | |
| env: | |
| RUST_CHANNEL: ${{ env.RUST_CHANNEL }} | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 | |
| - name: Install cargo-semver-checks | |
| run: cargo install --locked cargo-semver-checks | |
| - name: Determine the next version | |
| id: bump | |
| continue-on-error: true | |
| run: | | |
| b="major" | |
| for t in patch minor; do | |
| echo "Checking whether the next version is $t" | |
| if RUSTFLAGS="--cfg tokio_unstable" cargo semver-checks --color never --package yozefu-lib --package yozefu-app --package yozefu-wasm-types --package yozefu-command --baseline-rev "${CURRENT_VERSION}" --release-type "$t"; then | |
| b="$t" | |
| break | |
| fi | |
| done | |
| echo $b | |
| echo "bump=$b" >> "$GITHUB_OUTPUT" | |
| env: | |
| CURRENT_VERSION: ${{ needs.setup.outputs.currentVersion }} | |
| - name: Comment the pull request | |
| run: | | |
| echo "::info title=Next version:: Last public version is '${CURRENT_VERSION}' but version of this branch is '${NEXT_VERSION}'." | |
| { | |
| printf "This pull request is not ready because version \`%s\` is already published." "${CURRENT_VERSION}" | |
| printf "\nAccording to \`cargo-semver-checks\`, the next version should be \`v%s\`:" "$(bash .github/workflows/semver.sh bump ${BUMP} ${CURRENT_VERSION} | tr -d "\n")" | |
| printf "\n" | |
| echo '```shell' | |
| printf "git checkout %s\n" "$branch" | |
| echo "cargo release ${BUMP} --no-push --no-tag --no-publish --no-confirm --execute" | |
| echo "git push" | |
| echo '```' | |
| echo "More details at https://github.com/MAIF/yozefu/blob/main/docs/release/README.md" | |
| } >> report.md | |
| gh pr comment ${{ github.event.number }} --body-file ./report.md | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| branch: '${{ toJSON(github.head_ref) }}' | |
| CURRENT_VERSION: ${{ needs.setup.outputs.currentVersion }} | |
| NEXT_VERSION: ${{ needs.setup.outputs.nextVersion }} | |
| BUMP: ${{ steps.bump.outputs.bump }} |