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 | 50479a7 | 2022-08-30 00:23:01 -0400 | [diff] [blame^] | 13 | - run: | |
| 14 | echo "Releases: $(./ci/build-release-matrix)" |
| 15 | echo "Projects: $(./ci/build-project-matrix)" |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 16 | - id: set-matrix |
| 17 | run: | |
Mohammed Naser | 281f2dd | 2022-08-30 00:21:29 -0400 | [diff] [blame] | 18 | echo "::set-output name=release::$(./ci/build-release-matrix)" |
| 19 | echo "::set-output name=project::$(./ci/build-project-matrix)" |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 20 | outputs: |
| 21 | release_matrix: ${{ steps.set-matrix.outputs.release }} |
| 22 | project_matrix: ${{ steps.set-matrix.outputs.project }} |
| 23 | |
| 24 | build-openstack-images: |
| 25 | runs-on: ubuntu-latest |
| 26 | strategy: |
| 27 | fail-fast: false |
| 28 | matrix: |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 29 | release: ${{ fromJson(needs.build-matrix.outputs.release_matrix) }} |
Mohammed Naser | 50479a7 | 2022-08-30 00:23:01 -0400 | [diff] [blame^] | 30 | project: ${{ fromJson(needs.build-matrix.outputs.project_matrix) }} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 31 | steps: |
| 32 | - uses: actions/checkout@v3 |
| 33 | - uses: docker/setup-qemu-action@v2 |
| 34 | - uses: docker/setup-buildx-action@v2 |
| 35 | - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV |
| 36 | - uses: docker/login-action@v2 |
| 37 | with: |
| 38 | registry: quay.io |
| 39 | username: ${{ secrets.QUAY_USERNAME }} |
| 40 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 41 | - uses: docker/build-push-action@v3 |
| 42 | with: |
| 43 | context: images/openstack |
| 44 | cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }} |
| 45 | cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }} |
| 46 | platforms: ${{ env.PLATFORMS }} |
| 47 | push: true |
| 48 | build-args: | |
| 49 | RELEASE=${{ matrix.release }} |
| 50 | PROJECT=${{ matrix.project }} |
| 51 | PROJECT_REF=${{ env.PROJECT_REF }} |
| 52 | PROFILES=${{ env.PROFILES }} |
| 53 | DIST_PACKAGES=${{ env.DIST_PACKAGES }} |
| 54 | PIP_PACKAGES=${{ env.PIP_PACKAGES }} |
| 55 | tags: | |
| 56 | quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }} |
| 57 | |
| 58 | # TODO(mnaser): Molecule |
| 59 | |
| 60 | promote-openstack-images: |
| 61 | if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} |
| 62 | needs: |
| 63 | - build-openstack-images |
| 64 | runs-on: ubuntu-latest |
| 65 | strategy: |
| 66 | fail-fast: false |
| 67 | matrix: |
| 68 | project: ${{ fromJson(needs.build-matrix.outputs.project_matrix) }} |
| 69 | release: ${{ fromJson(needs.build-matrix.outputs.release_matrix) }} |
| 70 | steps: |
| 71 | - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV |
| 72 | - uses: docker/login-action@v2 |
| 73 | with: |
| 74 | registry: quay.io |
| 75 | username: ${{ secrets.QUAY_USERNAME }} |
| 76 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 77 | - uses: akhilerm/tag-push-action@v2.0.0 |
| 78 | with: |
| 79 | src: quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }} |
| 80 | dst: quay.io/vexxhost/${{ matrix.project }}:${{ matrix.release }} |