2121 required : false
2222 default : true
2323 type : boolean
24+ nightly :
25+ description : " Mark as nightly build"
26+ required : true
27+ default : true
28+ type : boolean
2429
2530permissions :
2631 contents : write
@@ -43,11 +48,45 @@ jobs:
4348 - openbsd
4449 - windows
4550 steps :
51+ - name : Disable release on nightly repository
52+ if : ${{ !inputs.nightly }}
53+ run : |
54+ if [ "$GITHUB_REPOSITORY" == "openbao/openbao-nightly" ]; then
55+ echo "Refusing to run non-nightly release on nightly repo" 1>&2
56+ exit 1
57+ fi
58+
4659 - name : Checkout
4760 uses : actions/checkout@v4.1.7
4861 with :
4962 fetch-depth : 0 # Required by GoRelease
5063
64+ - name : Disable nightly on primary repository
65+ if : inputs.nightly
66+ env :
67+ PRERELEASE : ${{ inputs.prerelease }}
68+ run : |
69+ if [ "$GITHUB_REPOSITORY" != "openbao/openbao-nightly" ]; then
70+ echo "Refusing to run nightly release on non-nightly repo" 1>&2
71+ exit 1
72+ fi
73+
74+ # Locally remove previous nightly tags so they do not interfere
75+ # with nightly tag computation. Also add the upstream.
76+ for tag in $(git tag); do
77+ if [[ "$tag" == *nightly* ]]; then
78+ echo "Deleting $tag"
79+ git tag --delete "$tag"
80+ fi
81+ done
82+ git remote add upstream https://github.com/openbao/openbao
83+ git fetch --all
84+
85+ # Then create a nightly tag for this commit. Because this uses the
86+ # time of commit, it is stable across different runners.
87+ nightly_tag="$(bash ./scripts/nightly_tag.sh)"
88+ git tag "$nightly_tag"
89+
5190 - name : Golang Setup
5291 uses : ./.github/actions/set-up-go
5392
@@ -98,22 +137,22 @@ jobs:
98137 key : ${{ github.ref }}
99138
100139 - name : " Docker Login: ghcr.io"
101- if : startsWith(github.ref, 'refs/tags/')
140+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
102141 uses : docker/login-action@v3
103142 with :
104143 registry : ghcr.io
105144 username : ${{ github.actor }}
106145 password : ${{ secrets.GITHUB_TOKEN }}
107146
108147 - name : " Docker Login: docker.io"
109- if : startsWith(github.ref, 'refs/tags/')
148+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
110149 uses : docker/login-action@v3
111150 with :
112151 username : ${{ secrets.DOCKER_USERNAME }}
113152 password : ${{ secrets.DOCKER_TOKEN }}
114153
115154 - name : " Docker Login: quay.io"
116- if : startsWith(github.ref, 'refs/tags/')
155+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
117156 uses : docker/login-action@v3
118157 with :
119158 registry : quay.io
@@ -122,7 +161,7 @@ jobs:
122161
123162 # Needed for nPFM
124163 - name : Create GPG Signing Key File
125- if : startsWith(github.ref, 'refs/tags/')
164+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
126165 run : |
127166 GPG_KEY_FILE=/tmp/signing-key.gpg
128167 echo "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" | base64 -di > "${GPG_KEY_FILE}"
@@ -145,14 +184,14 @@ jobs:
145184
146185 # Execute Go binary builds
147186 - name : " Template GoRelaser configuration"
148- if : startsWith(github.ref, 'refs/tags/')
187+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
149188 run : |
150189 sed "s/REPLACE_WITH_RELEASE_GOOS/${{ matrix.release_os }}/g" .goreleaser-template.yaml > .goreleaser.yaml
151190 sed -i "s/^#OTHERARCH#//g" .goreleaser.yaml
152191 [ "${{ matrix.release_os }}" == "linux" ] && sed -i "s/^#LINUXONLY#//g" .goreleaser.yaml || true
153192
154193 - name : " GoReleaser: Release"
155- if : startsWith(github.ref, 'refs/tags/')
194+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
156195 uses : goreleaser/goreleaser-action@v6
157196 with :
158197 distribution : goreleaser
@@ -168,6 +207,7 @@ jobs:
168207 GITHUB_RELEASE_PRERELEASE : ${{ inputs.prerelease }}
169208 GITHUB_RELEASE_MAKE_LATEST : ${{ inputs.make-latest }}
170209 NFPM_DEFAULT_PASSPHRASE : ${{ secrets.GPG_PASSWORD }}
210+ NIGHTLY_RELEASE : ${{ inputs.nightly }}
171211
172212 - name : Remove GPG Signing Key File
173213 if : always()
0 commit comments