-
Notifications
You must be signed in to change notification settings - Fork 13
35 lines (31 loc) · 1.18 KB
/
build-deploy.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
name: Build and Deploy containers
on:
# Always test on pull request
pull_request: []
# Deploy on merge to main
push:
branches:
- main
jobs:
deploy-test-containers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# matrix: [tag, path to Dockerfile, label]
matrix:
dockerfile: [[spack-bot, ./Dockerfile, Spackbot],
[spackbot-workers, ./workers/Dockerfile, "Spackbot Workers"]]
name: Build ${{matrix.dockerfile[2]}} Container
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build and Run Test Container
run: |
docker build -f ${{matrix.dockerfile[1]}} -t ghcr.io/spack/${{matrix.dockerfile[0]}}:latest .
docker tag ghcr.io/spack/${{matrix.dockerfile[0]}}:latest ghcr.io/spack/${{matrix.dockerfile[0]}}:${GITHUB_SHA::8}
- name: Login and Deploy Test Container
if: (github.event_name != 'pull_request')
run: |
docker images
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
docker push --all-tags ghcr.io/spack/${{matrix.dockerfile[0]}}