-
Notifications
You must be signed in to change notification settings - Fork 10
54 lines (50 loc) · 2.06 KB
/
docker-build.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Workflows Docker Build
on:
push:
env:
REGISTRY: ghcr.io
jobs:
list-images:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.set-matrix.outputs.images }}
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: set matrix
id: set-matrix
run: echo "images=$(find docker -maxdepth 2 -mindepth 2 -not -path "*/cellranger/*" | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
build-images:
needs: list-images
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{ fromJson(needs.list-images.outputs.images) }}
steps:
- name: Set Env
run: |
echo "TOOL=$(basename `dirname "${{ matrix.image }}"` | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "SEMVER=$(basename "${{ matrix.image }}")" >> $GITHUB_ENV
echo "IMAGE_TAG=$(basename "${{ matrix.image }}")" >> $GITHUB_ENV
echo "GH_REF=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set Branch Tag
if: github.ref != 'refs/heads/main'
run: echo "IMAGE_TAG=branch-${GITHUB_REF##*/}-${{ env.SEMVER }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Log in to the Container registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} --username ${{ github.actor }} --password-stdin
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.STJUDE_SEQERR_READONLY_DEPLOY_KEY }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
context: ${{ matrix.image }}
push: true
ssh: default
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.TOOL }}:${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.TOOL }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.TOOL }}:buildcache,mode=max