Skip to content

Commit 2e32c0d

Browse files
authored
ci: fixes nightly release
1 parent bc74ac6 commit 2e32c0d

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
name: Nightly Release
2+
23
on:
34
schedule:
4-
- cron: '0 0 * * *'
5+
- cron: "0 0 * * *"
56
workflow_dispatch: {}
7+
68
jobs:
7-
check-date:
8-
name: Check dates
9+
nightly-release:
10+
name: Nightly Build and Release Docker image (if code changed in 24h)
911
runs-on: ubuntu-latest
10-
outputs:
11-
should-run: ${{ steps.code-change.outputs.should-run }}
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v2
15-
- name: Check if code has changed with 24 hours
16-
continue-on-error: true
14+
uses: actions/checkout@v4
15+
16+
- name: Check if code has changed within 24 hours
1717
id: code-change
1818
run: |
19-
[[ $(git rev-list --after="24 hours" --first-parent HEAD) ]] && echo "::set-output name=should-run::true"
20-
build-release:
21-
name: Build and release Docker image
22-
runs-on: ubuntu-latest
23-
needs: check-date
24-
if: needs.check-date.outputs.should-run == 'true'
25-
steps:
26-
- name: Checkout repository
27-
uses: actions/checkout@v2
19+
if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then
20+
echo "should-run=true" >> $GITHUB_OUTPUT
21+
else
22+
echo "should-run=false" >> $GITHUB_OUTPUT
23+
fi
24+
2825
- name: Login into GitHub Container Registry
29-
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
26+
if: steps.code-change.outputs.should-run == 'true'
27+
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
28+
3029
- name: Build Docker image
30+
if: steps.code-change.outputs.should-run == 'true'
3131
run: |
3232
docker build \
3333
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
3434
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .
35+
3536
- name: Release Docker image
37+
if: steps.code-change.outputs.should-run == 'true'
3638
run: |
3739
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
38-
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"
40+
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly

0 commit comments

Comments
 (0)