Nightly Docker container build #682
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Metadata action | |
uses: docker/[email protected] | |
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/[email protected] | |
with: | |
file: .ci/Dockerfile.nightly | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
COMMIT=${{ github.sha }} |