blob: e608af37f36ac7d6ad3f0074ad873021a835e816 [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
Mohammed Naser4762fb92022-08-30 00:42:11 -040020 needs:
21 - build-matrix
Mohammed Nasera4e52902022-08-30 00:20:05 -040022 strategy:
23 fail-fast: false
Mohammed Naser3c78b712022-08-30 00:40:15 -040024 matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040025 steps:
Mohammed Naser82e50812022-08-30 00:58:10 -040026 - uses: actions/checkout@v3.0.2
27 - uses: docker/setup-qemu-action@v2.0.0
28 - uses: docker/setup-buildx-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040029 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
Mohammed Naser82e50812022-08-30 00:58:10 -040030 - uses: docker/login-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040031 with:
32 registry: quay.io
33 username: ${{ secrets.QUAY_USERNAME }}
34 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
Mohammed Naser82e50812022-08-30 00:58:10 -040035 - uses: docker/build-push-action@v3.1.1
Mohammed Nasera4e52902022-08-30 00:20:05 -040036 with:
37 context: images/openstack
38 cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }}
39 cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }}
40 platforms: ${{ env.PLATFORMS }}
41 push: true
42 build-args: |
43 RELEASE=${{ matrix.release }}
44 PROJECT=${{ matrix.project }}
45 PROJECT_REF=${{ env.PROJECT_REF }}
46 PROFILES=${{ env.PROFILES }}
47 DIST_PACKAGES=${{ env.DIST_PACKAGES }}
48 PIP_PACKAGES=${{ env.PIP_PACKAGES }}
49 tags: |
50 quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
51
52 # TODO(mnaser): Molecule
53
54 promote-openstack-images:
55 if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040056 runs-on: ubuntu-latest
Mohammed Naser4762fb92022-08-30 00:42:11 -040057 needs:
58 - build-matrix
59 - build-openstack-images
Mohammed Nasera4e52902022-08-30 00:20:05 -040060 strategy:
61 fail-fast: false
Mohammed Naser4762fb92022-08-30 00:42:11 -040062 matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040063 steps:
64 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
Mohammed Naser82e50812022-08-30 00:58:10 -040065 - uses: docker/login-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040066 with:
67 registry: quay.io
68 username: ${{ secrets.QUAY_USERNAME }}
69 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
70 - uses: akhilerm/tag-push-action@v2.0.0
71 with:
72 src: quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
73 dst: quay.io/vexxhost/${{ matrix.project }}:${{ matrix.release }}