-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78ec591
commit c136162
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Periodic Docker build | ||
|
||
on: | ||
# Build the Docker container whenever commits are pushed to an open PR (under conditions defined below) | ||
pull_request: | ||
|
||
# Build the Docker container at 00:00 on the first day of every 3 months | ||
schedule: | ||
- cron: '0 0 1 */3 *' | ||
|
||
jobs: | ||
docker: | ||
name: Build Docker container | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout the repo | ||
id: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Determine if this file changed compared with develop | ||
if: ${{ !(github.event_name == 'schedule') }} | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
.github/workflows/docker.yml | ||
docker/Dockerfile.devenv | ||
docker/spack.yaml | ||
base_sha: develop | ||
|
||
- name: Setup Docker buildx | ||
id: buildx | ||
if: ${{ (steps.changed-files.outputs.any_changed == 'true') || (github.event_name == 'schedule') }} | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into GitHub Container Repository | ||
id: login | ||
if: ${{ (steps.changed-files.outputs.any_changed == 'true') || ( github.event_name == 'schedule') }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
logout: true | ||
|
||
- name: Build container and push to ghcr | ||
id: build-and-push | ||
if: ${{ (steps.changed-files.outputs.any_changed == 'true') || (github.event_name == 'schedule') }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
no-cache: true | ||
file: docker/Dockerfile.devenv | ||
tags: ghcr.io/fetch4/giss-gc-dev-env:latest |