-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (52 loc) · 1.71 KB
/
nightly-docker-build.yml
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
45
46
47
48
49
50
51
52
53
54
55
name: Nightly Docker container build
# Once a day
on:
workflow_dispatch:
schedule:
- cron: '30 2 * * *'
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "name=should_run::false" >> $GITHUB_STATE
build:
runs-on: ubuntu-latest
name: Build Docker image
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
steps:
- uses: actions/checkout@v4
- name: DockerHub Login
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Metadata action
uses: docker/metadata-action@v4.1.1
id: meta
with:
images: ktakashi/sagittarius
tags: |
type=edge
flavor: latest=false
labels: |
org.opencontainers.image.authors=Takashi Kato
org.opencontainers.image.title=Sagittarius Scheme
org.opencontainers.image.description=Sagittarius Scheme nightly build
- name: Build and push Docker image
uses: docker/build-push-action@v3.2.0
with:
file: .ci/Dockerfile.nightly
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT=${{ github.sha }}