-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (67 loc) · 2.79 KB
/
build-push-c1-art.yml
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
name: Docker Build Main Push C1 Artifactory
on:
release:
types: [published]
workflow_dispatch:
jobs:
build-and-push-dev-c1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Add DoD Certificate Bundle
env:
CERT_BUNDLE_SHA256: ${{ secrets.DOD_CA_CERT_BUNDLE_SHA256 }}
run: |
echo "$CERT_BUNDLE_SHA256" > scripts/dod_ca_cert_bundle.sha256
sudo bash scripts/add-dod-cas.sh
- name: Docker meta
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4
with:
# list of Docker images to use as base name for tags
images: |
${{ secrets.C1_REGISTRY }}/${{ secrets.C1_REPOSITORY }}
tags: |
type=sha,prefix=,format=long
flavor: |
latest=false
- uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # v2
id: buildx
with:
config-inline: |
[registry."${{ secrets.C1_REGISTRY }}"]
ca=["/etc/ssl/certs/adoptium/cacerts"]
http = false
insecure = true
- name: Build
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4
with:
context: .
push: false
load: true
tags: ${{ secrets.C1_REGISTRY}}/${{ secrets.C1_REPOSITORY }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD=${{ github.sha }}
- name: Login to Dev Artifactory Container Registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2
with:
registry: ${{ secrets.C1_REGISTRY }}
username: ${{ secrets.C1_ART_USERNAME }}
password: ${{ secrets.C1_ARTIFACTORY_TOKEN }}
- name: Push image to C1 Dev, Test, and Prod Artifactory
id: push-c1-image
env:
IMAGE_TAG: ${{ github.sha }}
C1_REGISTRY: ${{ secrets.C1_REGISTRY }}
C1_REPOSITORY: ${{ secrets.C1_REPOSITORY }}
DEV_CERT: ${{ secrets.SAML_CERT }}
TEST_CERT: ${{ secrets.C1_TEST_SAML_CERT }}
PROD_CERT: ${{ secrets.C1_PROD_SAML_CERT }}
run: |
docker push $C1_REGISTRY/$C1_REPOSITORY:$IMAGE_TAG
docker tag $C1_REGISTRY/$C1_REPOSITORY:$IMAGE_TAG $C1_REGISTRY/dockerreadyfortest/portal/client:$IMAGE_TAG
docker push $C1_REGISTRY/dockerreadyfortest/portal/client:$IMAGE_TAG
docker tag $C1_REGISTRY/$C1_REPOSITORY:$IMAGE_TAG $C1_REGISTRY/dockerreadyforprod/portal/client:$IMAGE_TAG
docker push $C1_REGISTRY/dockerreadyforprod/portal/client:$IMAGE_TAG
echo "image=$C1_REGISTRY/$C1_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT