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,46 @@ 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+ git remote add upstream https://github.com/openbao/openbao
77+ git fetch --all
78+
79+ for tag in $(git tag); do
80+ if [[ "$tag" == *nightly* ]]; then
81+ echo "Deleting $tag"
82+ git tag --delete "$tag"
83+ fi
84+ done
85+
86+ # Then create a nightly tag for this commit. Because this uses the
87+ # time of commit, it is stable across different runners.
88+ nightly_tag="$(bash ./scripts/nightly_tag.sh)"
89+ git tag "$nightly_tag"
90+
5191 - name : Golang Setup
5292 uses : ./.github/actions/set-up-go
5393
@@ -98,22 +138,22 @@ jobs:
98138 key : ${{ github.ref }}
99139
100140 - name : " Docker Login: ghcr.io"
101- if : startsWith(github.ref, 'refs/tags/')
141+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
102142 uses : docker/login-action@v3
103143 with :
104144 registry : ghcr.io
105145 username : ${{ github.actor }}
106146 password : ${{ secrets.GITHUB_TOKEN }}
107147
108148 - name : " Docker Login: docker.io"
109- if : startsWith(github.ref, 'refs/tags/')
149+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
110150 uses : docker/login-action@v3
111151 with :
112152 username : ${{ secrets.DOCKER_USERNAME }}
113153 password : ${{ secrets.DOCKER_TOKEN }}
114154
115155 - name : " Docker Login: quay.io"
116- if : startsWith(github.ref, 'refs/tags/')
156+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
117157 uses : docker/login-action@v3
118158 with :
119159 registry : quay.io
@@ -122,7 +162,7 @@ jobs:
122162
123163 # Needed for nPFM
124164 - name : Create GPG Signing Key File
125- if : startsWith(github.ref, 'refs/tags/')
165+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
126166 run : |
127167 GPG_KEY_FILE=/tmp/signing-key.gpg
128168 echo "${{ secrets.GPG_PRIVATE_KEY_BASE64 }}" | base64 -di > "${GPG_KEY_FILE}"
@@ -145,14 +185,14 @@ jobs:
145185
146186 # Execute Go binary builds
147187 - name : " Template GoRelaser configuration"
148- if : startsWith(github.ref, 'refs/tags/')
188+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
149189 run : |
150190 sed "s/REPLACE_WITH_RELEASE_GOOS/${{ matrix.release_os }}/g" .goreleaser-template.yaml > .goreleaser.yaml
151191 sed -i "s/^#OTHERARCH#//g" .goreleaser.yaml
152192 [ "${{ matrix.release_os }}" == "linux" ] && sed -i "s/^#LINUXONLY#//g" .goreleaser.yaml || true
153193
154194 - name : " GoReleaser: Release"
155- if : startsWith(github.ref, 'refs/tags/')
195+ if : startsWith(github.ref, 'refs/tags/') || inputs.nightly
156196 uses : goreleaser/goreleaser-action@v6
157197 with :
158198 distribution : goreleaser
@@ -168,6 +208,7 @@ jobs:
168208 GITHUB_RELEASE_PRERELEASE : ${{ inputs.prerelease }}
169209 GITHUB_RELEASE_MAKE_LATEST : ${{ inputs.make-latest }}
170210 NFPM_DEFAULT_PASSPHRASE : ${{ secrets.GPG_PASSWORD }}
211+ NIGHTLY_RELEASE : ${{ inputs.nightly }}
171212
172213 - name : Remove GPG Signing Key File
173214 if : always()
0 commit comments