-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (49 loc) · 1.68 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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 }}