Skip to content

nightly

nightly #54

Workflow file for this run

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