-
Notifications
You must be signed in to change notification settings - Fork 50
53 lines (50 loc) · 1.88 KB
/
trigger-nightly.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
name: Trigger nightly build
on:
schedule:
# * is a special character in YAML, so you have to quote this string
# we want the nightly builds only on work days
- cron: '0 0 * * 2-6'
workflow_dispatch:
jobs:
trigger-nightly:
name: Push tag for nightly build
runs-on: ubuntu-latest
steps:
-
name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.NIGHTLY_BUILD_GH_TOKEN }}
fetch-depth: 0
-
name: 'Push new tag'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# A previous release was created using a lightweight tag
# git describe by default includes only annotated tags
# git describe --tags includes lightweight tags as well
DESCRIBE=`git tag -l --sort=-v:refname | grep -v nightly | head -n 1`
MAJOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[1]}'`
MINOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[2]}'`
MINOR_VERSION="$((${MINOR_VERSION} + 1))"
TAG="${MAJOR_VERSION}.${MINOR_VERSION}.0-nightly.$(date +'%Y%m%d')"
git tag -a $TAG -m "$TAG: nightly build"
git push origin $TAG
- name: 'Clean up nightly releases'
uses: dev-drprasad/delete-older-releases@v0.3.4
with:
keep_latest: 5
delete_tags: true
delete_tag_pattern: nightly
delete_prerelease_only: true
env:
GITHUB_TOKEN: ${{ secrets.NIGHTLY_BUILD_GH_TOKEN }}
- name: 'Delete nightly containers older than a week'
uses: snok/container-retention-policy@v3.0.0
with:
account: ConduitIO
image-names: conduit
image-tags: '*-nightly*'
cut-off: 1w
token: ${{ secrets.NIGHTLY_BUILD_GH_TOKEN }}