Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 1 | name: test |
| 2 | on: |
| 3 | pull_request: {} |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | |
| 8 | jobs: |
| 9 | build-matrix: |
| 10 | runs-on: ubuntu-latest |
| 11 | steps: |
| 12 | - uses: actions/checkout@v3.0.2 |
Mohammed Naser | 84c312d | 2022-08-30 00:36:45 -0400 | [diff] [blame] | 13 | - id: set-matrix |
Mohammed Naser | 3c78b71 | 2022-08-30 00:40:15 -0400 | [diff] [blame] | 14 | run: echo "::set-output name=matrix::$(./ci/build-matrix)" |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 15 | outputs: |
Mohammed Naser | 3c78b71 | 2022-08-30 00:40:15 -0400 | [diff] [blame] | 16 | matrix: ${{ steps.set-matrix.outputs.matrix }} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 17 | |
| 18 | build-openstack-images: |
| 19 | runs-on: ubuntu-latest |
| 20 | strategy: |
| 21 | fail-fast: false |
Mohammed Naser | 3c78b71 | 2022-08-30 00:40:15 -0400 | [diff] [blame] | 22 | matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 23 | 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 }} |