-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (75 loc) · 2.75 KB
/
buildx.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
76
77
78
79
80
81
82
83
84
85
86
87
name: buildx
on:
push:
branches:
- "main"
- "development"
- "staging"
jobs:
docker:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set environment specific variables
uses: jnus/[email protected]
with:
scope: ${{ github.ref_name }}
configFile: ".github/workflows/variables.json"
secrets: "${{ toJson(secrets.github_token) }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup docker context for buildx
id: buildx-context
run: docker context create builders || docker context use builders
- name: Extract repository name
id: extract_repo_name
run: |
repo_url=${{ github.repository }}
repo_name=$(basename $repo_url)
echo "REPO_NAME=${repo_name}" >> $GITHUB_ENV
echo "REPO_NAME=${repo_name}"
- name: set lower case owner name
run: |
echo "REPO_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ env.REPO_NAME }}"
- name: copy ca
run: |
sudo mkdir -p /etc/docker/certs.d/${{ secrets.REGISTRY_URL }}
echo "${{ secrets.REGISTRY_CA }}" | sudo tee /etc/docker/certs.d/${{ secrets.REGISTRY_URL }}/ca.crt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
config-inline: |
[registry."${{ secrets.REGISTRY_URL }}"]
http = false
insecure = true
ca=["/etc/docker/certs.d/${{ secrets.REGISTRY_URL }}/ca.crt"]
- uses: bilberrry-infra/docker-build-args-action@master
id: action
with:
includeVars: ${{ toJson(env) }}
includeSecrets: ${{ toJson(secrets) }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
platforms: |
linux/amd64
build-args: ${{ steps.action.outputs.args }}
tags: ${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:${{ github.sha }},${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:${{ github.ref_name }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:buildcache
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:buildcache,mode=max
notify-servers:
needs: docker
uses: fairdatasociety/ci_utils/.github/workflows/webhook.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
wh_secret: ${{ secrets.WEBHOOK_SECRET }}
wh_url_d: ${{ secrets.WEBHOOK_URL_DEVELOPMENT }}
wh_url_m: ${{ secrets.WEBHOOK_URL_MASTER }}
with:
branch: ${{ github.ref_name }}