-
-
Notifications
You must be signed in to change notification settings - Fork 40
40 lines (34 loc) · 1.28 KB
/
nightly-release.yaml
File metadata and controls
40 lines (34 loc) · 1.28 KB
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
name: Nightly Release
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch: {}
jobs:
nightly-release:
name: Nightly Build and Release Docker image (if code changed in 24h)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if code has changed within 24 hours
id: code-change
run: |
if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
else
echo "should-run=false" >> $GITHUB_OUTPUT
fi
- name: Login into GitHub Container Registry
if: steps.code-change.outputs.should-run == 'true'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker image
if: steps.code-change.outputs.should-run == 'true'
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:latest" .
- name: Release Docker image
if: steps.code-change.outputs.should-run == 'true'
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:latest"