forked from trustification/trustification
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (42 loc) · 1.52 KB
/
nightly.yaml
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
name: nightly
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # every night
permissions:
contents: write # for creating a release
jobs:
tag:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.NIGHTLY_TOKEN }}
- name: Clean old tags
run: |
./.github/prune-nightly.sh
- name: Eval tag
id: getflags
run: |
curl -sSLf https://github.com/TomWright/dasel/releases/download/v2.1.2/dasel_linux_amd64 -o dasel && chmod +x dasel
version="$(./dasel -f trust/Cargo.toml -r toml -s package.version)"
commit="$(echo -n $GITHUB_SHA | head -c 8)"
tag="v${version}-nightly.${commit}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "commit=$commit" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
# now check to see if tag already exists, so that we can avoid the error
if [[ $(git tag -l "$tag") ]]; then
need_tag=false
else
need_tag=true
fi
echo "need_tag=$need_tag" >> "$GITHUB_OUTPUT"
- name: Tag it
if: ${{ steps.getflags.outputs.need_tag == 'true' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Trustification CI"
git tag ${{ steps.getflags.outputs.tag }} -m 'Nightly release'
git push --follow-tags