summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-09-30 23:34:47 +0200
committerGitHub <noreply@github.com>2021-09-30 23:34:47 +0200
commit8ade8a77dd337a4d673575749f2545b1629aa254 (patch)
tree0082ad6be1f7cf0c3d92934b01e5605722592e73 /.github/workflows
parent7bda430de0cb239bbb7ab86c7b6a7aa500fb9441 (diff)
downloadspack-8ade8a77dd337a4d673575749f2545b1629aa254.tar.gz
spack-8ade8a77dd337a4d673575749f2545b1629aa254.tar.bz2
spack-8ade8a77dd337a4d673575749f2545b1629aa254.tar.xz
spack-8ade8a77dd337a4d673575749f2545b1629aa254.zip
Build container images on Github Actions and push to multiple registries (#26247)
Modifications: - Modify the workflow to build container images without pushing when the workflow file itself is modified - Strip the leading ghcr.io/spack/ from env.container env.versioned to prepare pushing to multiple registries - Fixed CentOS 7 and Amazon Linux builds - Login and push to Docker Hub as well as Github Action - Add a badge to README.md with the status of docker images
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-containers.yml38
1 files changed, 27 insertions, 11 deletions
diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml
index d2dd2d825e..74c7c9e1b1 100644
--- a/.github/workflows/build-containers.yml
+++ b/.github/workflows/build-containers.yml
@@ -1,8 +1,16 @@
-name: Build & Deploy Docker Containers
+name: Containers
on:
+ # This Workflow can be triggered manually
+ workflow_dispatch:
# Build new Spack develop containers nightly.
schedule:
- cron: '34 0 * * *'
+ # Run on pull requests that modify this file
+ pull_request:
+ branches:
+ - develop
+ paths:
+ - '.github/workflows/build-containers.yml'
# Let's also build & tag Spack containers on releases.
release:
types: [published]
@@ -29,7 +37,7 @@ jobs:
- name: Set Container Tag Normal (Nightly)
run: |
- container="ghcr.io/spack/${{ matrix.dockerfile[0]}}:latest"
+ container="${{ matrix.dockerfile[0] }}:latest"
echo "container=${container}" >> $GITHUB_ENV
echo "versioned=${container}" >> $GITHUB_ENV
@@ -37,7 +45,7 @@ jobs:
- name: Set Container Tag on Release
if: github.event_name == 'release'
run: |
- versioned="ghcr.io/spack/${{matrix.dockerfile[0]}}:${GITHUB_REF##*/}"
+ versioned="${{matrix.dockerfile[0]}}:${GITHUB_REF##*/}"
echo "versioned=${versioned}" >> $GITHUB_ENV
- name: Check ${{ matrix.dockerfile[1] }} Exists
@@ -48,6 +56,12 @@ jobs:
exit 1;
fi
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
@@ -55,18 +69,20 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v1
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
+ - name: Log in to DockerHub
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Deploy ${{ matrix.dockerfile[1] }}
uses: docker/build-push-action@v2
with:
file: share/spack/docker/${{matrix.dockerfile[1]}}
platforms: ${{ matrix.dockerfile[2] }}
- push: true
+ push: ${{ github.event_name != 'pull_request' }}
tags: |
- ${{ env.container }}
- ${{ env.versioned }}
+ spack/${{ env.container }}
+ spack/${{ env.versioned }}
+ ghcr.io/spack/${{ env.container }}
+ ghcr.io/spack/${{ env.versioned }}