blob: a95a9fb38106e9dfcf9907a621f79c9158b2b2c3 [file] [log] [blame]
Mohammed Nasera4e52902022-08-30 00:20:05 -04001name: test
2on:
3 pull_request: {}
4 push:
5 branches:
6 - main
7
8jobs:
9 build-matrix:
10 runs-on: ubuntu-latest
11 steps:
12 - uses: actions/checkout@v3.0.2
Mohammed Naser84c312d2022-08-30 00:36:45 -040013 - id: set-matrix
Mohammed Naser3c78b712022-08-30 00:40:15 -040014 run: echo "::set-output name=matrix::$(./ci/build-matrix)"
Mohammed Nasera4e52902022-08-30 00:20:05 -040015 outputs:
Mohammed Naser3c78b712022-08-30 00:40:15 -040016 matrix: ${{ steps.set-matrix.outputs.matrix }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040017
18 build-openstack-images:
19 runs-on: ubuntu-latest
20 strategy:
21 fail-fast: false
Mohammed Naser3c78b712022-08-30 00:40:15 -040022 matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040023 steps:
24 - uses: actions/checkout@v3
25 - uses: docker/setup-qemu-action@v2
26 - uses: docker/setup-buildx-action@v2
27 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
28 - uses: docker/login-action@v2
29 with:
30 registry: quay.io
31 username: ${{ secrets.QUAY_USERNAME }}
32 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
33 - uses: docker/build-push-action@v3
34 with:
35 context: images/openstack
36 cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }}
37 cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }}
38 platforms: ${{ env.PLATFORMS }}
39 push: true
40 build-args: |
41 RELEASE=${{ matrix.release }}
42 PROJECT=${{ matrix.project }}
43 PROJECT_REF=${{ env.PROJECT_REF }}
44 PROFILES=${{ env.PROFILES }}
45 DIST_PACKAGES=${{ env.DIST_PACKAGES }}
46 PIP_PACKAGES=${{ env.PIP_PACKAGES }}
47 tags: |
48 quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
49
50 # TODO(mnaser): Molecule
51
52 promote-openstack-images:
53 if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
54 needs:
55 - build-openstack-images
56 runs-on: ubuntu-latest
57 strategy:
58 fail-fast: false
59 matrix:
60 project: ${{ fromJson(needs.build-matrix.outputs.project_matrix) }}
61 release: ${{ fromJson(needs.build-matrix.outputs.release_matrix) }}
62 steps:
63 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
64 - uses: docker/login-action@v2
65 with:
66 registry: quay.io
67 username: ${{ secrets.QUAY_USERNAME }}
68 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
69 - uses: akhilerm/tag-push-action@v2.0.0
70 with:
71 src: quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
72 dst: quay.io/vexxhost/${{ matrix.project }}:${{ matrix.release }}