ci: pin cargo-semver-checks version and cron job
This commit is contained in:
parent
8a91015769
commit
f76f68217b
|
@ -0,0 +1 @@
|
||||||
|
0.33.0
|
|
@ -0,0 +1,40 @@
|
||||||
|
name: Update cargo-semver-checks
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * 6" # runs every Saturday at 00:00
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
jobs:
|
||||||
|
format:
|
||||||
|
name: Update cargo-semver-checks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Update semver-checks to use latest crates.io published version
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
# Grab the latest version of cargo semver-checks from crates.io
|
||||||
|
# that is not yanked.
|
||||||
|
LATEST_VERSION=$(curl --proto '=https' --tlsv1.3 -sSf https://crates.io/api/v1/crates/cargo-semver-checks/versions | jq -r 'first( .versions[] | select(.yanked =- false) ) | .num')
|
||||||
|
# Update the latest version in the reference file.
|
||||||
|
echo "${LATEST_VERSION}" > ./.github/workflows/cargo-semver-checks-version
|
||||||
|
echo "cargo_semver_checks_version=${LATEST_VERSION}" >> $GITHUB_ENV
|
||||||
|
# If somehow the latest version has not changed. In this case don't make an empty PR.
|
||||||
|
if ! git diff --exit-code > /dev/null; then
|
||||||
|
echo "Updated cargo-semver-checks. Opening PR."
|
||||||
|
echo "changes_made=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "Attempted to update cargo-semver-checks but the crates.io version did not change. Not opening any PR."
|
||||||
|
echo "changes_made=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Create Pull Request
|
||||||
|
if: env.changes_made == 'true'
|
||||||
|
uses: peter-evans/create-pull-request@v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
|
||||||
|
author: Update cargo-semver-checks Bot <bot@example.com>
|
||||||
|
committer: Update cargo-semver-checks Bot <bot@example.com>
|
||||||
|
title: Automated weekly update to cargo-semver-checks (to ${{ env.cargo_semver_checks_version }})
|
||||||
|
body: |
|
||||||
|
Automated update to Github CI workflow `semver-checks.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
|
||||||
|
commit-message: Automated update to Github CI to cargo-semver-checks version-${{ env.cargo_semver_checks_version }}
|
||||||
|
branch: create-pull-request/weekly-cargo-semver-checks-update
|
|
@ -21,8 +21,8 @@ jobs:
|
||||||
rustup default $(cat ./.github/workflows/stable-version)
|
rustup default $(cat ./.github/workflows/stable-version)
|
||||||
- name: "Install cargo-binstall"
|
- name: "Install cargo-binstall"
|
||||||
uses: cargo-bins/cargo-binstall@main
|
uses: cargo-bins/cargo-binstall@main
|
||||||
- name: "Binstall cargo-semver-checks"
|
- name: "Binstall pinned cargo-semver-checks"
|
||||||
run: cargo binstall cargo-semver-checks --no-confirm
|
run: cargo binstall cargo-semver-checks@$(cat ./.github/workflows/cargo-semver-checks-version) --no-confirm
|
||||||
- name: "Run semver checker script"
|
- name: "Run semver checker script"
|
||||||
run: ./contrib/check-semver-pr.sh
|
run: ./contrib/check-semver-pr.sh
|
||||||
- name: Save PR number
|
- name: Save PR number
|
||||||
|
@ -58,8 +58,8 @@ jobs:
|
||||||
rustup default $(cat ./.github/workflows/stable-version)
|
rustup default $(cat ./.github/workflows/stable-version)
|
||||||
- name: "Install cargo-binstall"
|
- name: "Install cargo-binstall"
|
||||||
uses: cargo-bins/cargo-binstall@main
|
uses: cargo-bins/cargo-binstall@main
|
||||||
- name: "Binstall cargo-semver-checks"
|
- name: "Binstall pinned cargo-semver-checks"
|
||||||
run: cargo binstall cargo-semver-checks --no-confirm
|
run: cargo binstall cargo-semver-checks@$(cat ./.github/workflows/cargo-semver-checks-version) --no-confirm
|
||||||
- name: "Run semver checker script"
|
- name: "Run semver checker script"
|
||||||
run: ./contrib/check-semver-feature.sh
|
run: ./contrib/check-semver-feature.sh
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue