forked from hpcc-systems/HPCC-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (102 loc) · 4.26 KB
/
build-containers-target-branch.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Docker target branch build
on:
push:
branches:
- "master"
- "candidate-*.x"
- "!candidate-8.2.*"
- "!candidate-8.0.*"
- "!candidate-7.12.*"
- "!candidate-7.10.*"
- "!candidate-7.8.*"
- "!candidate-7.6.*"
- "!candidate-7.4.*"
- "!candidate-7.2.*"
- "!candidate-7.0.*"
- "!candidate-6.*"
jobs:
check-skip:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-20.04
# Map a step output to a job output
outputs:
changed: ${{ steps.skip_check.outputs.dockerfiles || steps.skip_check.outputs.platform }}
steps:
- id: skip_check
uses: hpcc-systems/github-actions/changed-modules@main
with:
github_token: ${{ github.token }}
build-images:
needs: check-skip
if: ${{ needs.check-skip.outputs.changed }}
runs-on: ubuntu-20.04
steps:
- name: vars
id: vars
run: |
# echo ::set-output name=container_registry::ghcr.io
# echo ::set-output name=cr_user::${{ github.repository_owner }}
echo ::set-output name=container_registry::docker.io
echo ::set-output name=cr_user::hpccbuilds
echo ::set-output name=build_base_sha::${{ github.sha }}
echo ::set-output name=build_base_label::${GITHUB_REF##*/}
echo ::set-output name=build_user::${{ github.actor }}
echo ::set-output name=build_type::RelWithDebInfo
echo ::set-output name=use_cppunit::1
echo ::set-output name=platform_build::smoketest-platform-build-vcpkg
- name: tracing
run: |
echo "Action = ${{ github.action }}"
echo "Event = ${{ github.event_name }}"
echo "Actor = ${{ github.actor }}"
echo "Ref = ${{ github.ref }}"
echo "Sha = ${{ github.sha }}"
echo "github.repository = ${{ github.repository }}"
echo "repository_owner = ${{ github.repository_owner }}"
echo "github.workspace = ${{ github.workspace }}"
echo "runner.workspace = ${{ runner.workspace }}"
echo "build_base_sha = ${{ steps.vars.outputs.build_base_sha }}"
echo "build_base_label = ${{ steps.vars.outputs.build_base_label }}"
- name: Checkout
uses: actions/checkout@v2
- name: Calculate vcpkg vars
id: vcpkg_vars
run: |
echo "base_ver=$(git submodule status vcpkg | cut -c2-9)" >> $GITHUB_OUTPUT
- name: tracing (vcpkg_vars)
run: |
echo "vcpkg_vars.base_ver = ${{ steps.vcpkg_vars.outputs.base_ver }}"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# build branch image
- name: branch image
uses: docker/build-push-action@v2
with:
context: .
file: ./dockerfiles/platform-build/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
tags: |
${{ steps.vars.outputs.container_registry }}/${{ steps.vars.outputs.cr_user }}/${{ steps.vars.outputs.platform_build }}:${{ steps.vars.outputs.build_base_label }}-${{ steps.vars.outputs.build_base_sha }}
${{ steps.vars.outputs.container_registry }}/${{ steps.vars.outputs.cr_user }}/${{ steps.vars.outputs.platform_build }}:${{ steps.vars.outputs.build_base_label }}-latest
push: true
build-args: |
CR_REPO=${{ steps.vars.outputs.container_registry }}
BASE_VER=${{ steps.vcpkg_vars.outputs.base_ver }}
BUILD_USER=${{ github.repository_owner }}
BUILD_TAG=${{ steps.vars.outputs.build_base_sha }}
BUILD_TYPE=${{ steps.vars.outputs.build_type }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
USE_CPPUNIT=${{ steps.vars.outputs.use_cppunit }}
BUILD_THREADS=${{ steps.vars.outputs.build_threads }}