-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
44 lines (44 loc) · 1.42 KB
/
nightly-release.yaml
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
name: Nightly Release
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
jobs:
check_code_change:
name: Check code change
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.code_change.outputs.should_run }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if code has changed with 24 hours
continue-on-error: true
id: code_change
run: |
if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
fi
build_tag_publish:
name: Build, tag and publish Docker image
runs-on: ubuntu-latest
needs: check_code_change
if: needs.check_code_change.outputs.should_run == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get short SHA
id: short_sha
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: "ghcr.io/jef/streetmerchant:nightly,ghcr.io/jef/streetmerchant:${{ steps.short_sha.outputs.short_sha }}"