Update SPDX and Release #236
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: Update SPDX and Release | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
submodules: recursive | |
- run: git submodule update --recursive --remote | |
- name: Check for new release in submodule | |
run: | | |
CURRENT_VERSION=$(cat VERSION) | |
NEW_VERSION=$(git -C license-list-data describe --abbrev=0) | |
NEW_VERSION="${NEW_VERSION#v}" | |
echo "CURRENT_VERSION=$CURRENT_VERSION" >> "$GITHUB_ENV" | |
echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | |
echo "$NEW_VERSION" > VERSION | |
- name: Update cargo version | |
run: | | |
cargo install cargo-edit | |
cargo set-version --bump minor | |
cargo set-version -m "$NEW_VERSION" | |
if: ${{ env.CURRENT_VERSION != env.NEW_VERSION }} | |
- run: cargo test | |
if: ${{ env.CURRENT_VERSION != env.NEW_VERSION }} | |
- name: Release | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git commit -am "Update license-list-data to $NEW_VERSION" | |
cargo package | |
git push | |
cargo_version=$(cargo pkgid | cut -d# -f2) | |
git tag -a "v$cargo_version" -m "Update SPDX to $NEW_VERSION" | |
git push origin "v$cargo_version" | |
cargo publish | |
if: ${{ env.CURRENT_VERSION != env.NEW_VERSION }} | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |