-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (73 loc) · 2.38 KB
/
publish.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
# Automatically build Docker images on changes to main and push them to a
# Container Registry using HCL Bake file.
name: Build Docker Images
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
push:
branches: ['main','demo_*','hackathon_*']
tags: ['*']
pull_request:
branches: ['main']
permissions:
contents: read
packages: write
jobs:
# Call the Tag Generator to generate an image tag to use
tag-generator:
uses: darpa-askem/.github/.github/workflows/tag-generator.yaml@main
publish:
name: sequence-build-deploy
runs-on: ubuntu-22.04
needs:
- tag-generator
steps:
- name: Set env variables for bakefiles
run: |
# Lowercase the inputs for Docker image naming conventions
TAG=${{ needs.tag-generator.outputs.tag }}
ORG=${{ github.repository_owner }}
# REG=${{ inputs.registry }}
echo "VERSION=${TAG,,}" >> ${GITHUB_ENV}
echo "DOCKER_ORG=${ORG,,}" >> ${GITHUB_ENV}
# echo "DOCKER_REGISTRY=${REG,,}" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: 'ghcr.io'
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 2.4 - Setup QEMU for platform emulation
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# 2.5 - Setup Docker BuildX for multi platform building
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 2.6 - Build and push Docker Images
- name: Build Images using BuildX Bake
uses: docker/bake-action@v3.1.0
with:
files: |
./docker/docker-bake.hcl
targets: funman-api-multiplatform
push: true
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
# # Build and Publish all targets associated with specified group
# bake:
# needs:
# - tag-generator
# uses: darpa-askem/.github/.github/workflows/bake-publish.yml@main
# with:
# file: 'docker-bake.hcl'
# group: 'prod'
# registry: 'ghcr.io'
# organization: ${{ github.repository_owner }}
# tag: ${{ needs.tag-generator.outputs.tag }}
# secrets:
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}