|
6 | 6 | - staging
|
7 | 7 | pull_request: {}
|
8 | 8 | jobs:
|
| 9 | + set-matrix: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + with: |
| 16 | + # Fetch everything to be able to find changed images |
| 17 | + fetch-depth: 0 |
| 18 | + - run: '.ci/changed-images' |
| 19 | + - id: set-matrix |
| 20 | + run: 'echo "::set-output name=matrix::$(.ci/changed-images --matrix)"' |
9 | 21 | build:
|
| 22 | + if: github.ref != 'refs/heads/master' |
| 23 | + needs: set-matrix |
| 24 | + runs-on: ubuntu-latest |
| 25 | + strategy: |
| 26 | + matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} |
| 27 | + fail-fast: false |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + - id: set-tags |
| 31 | + run: | |
| 32 | + set -e |
| 33 | + echo "::set-output name=tags::" |
| 34 | + cat "${{ matrix.image }}/tags" |
| 35 | + - uses: docker/setup-buildx-action@v1 |
| 36 | + id: buildx |
| 37 | + with: |
| 38 | + version: latest |
| 39 | + install: true |
| 40 | + id: docker_build |
| 41 | + - uses: docker/build-push-action@v2 |
| 42 | + id: docker_build |
| 43 | + with: |
| 44 | + push: false |
| 45 | + tags: ${{ steps.set-tags.outputs.tags }} |
| 46 | + context: ${{ matrix.image }} |
| 47 | + - name: Image digest |
| 48 | + run: echo ${{ steps.docker_build.outputs.digest }} |
| 49 | + build-and-push: |
| 50 | + if: github.ref == 'refs/heads/master' |
| 51 | + needs: set-matrix |
10 | 52 | runs-on: ubuntu-latest
|
| 53 | + strategy: |
| 54 | + matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} |
| 55 | + fail-fast: false |
11 | 56 | steps:
|
12 |
| - - run: echo "hello world" |
| 57 | + - uses: docker/login-action@v1 |
| 58 | + with: |
| 59 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 60 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + - id: set-tags |
| 63 | + run: 'echo "::set-output name=tags::$(.ci/tags-to-json "${{ matrix.image }}")"' |
| 64 | + - uses: docker/setup-buildx-action@v1 |
| 65 | + id: buildx |
| 66 | + with: |
| 67 | + version: latest |
| 68 | + install: true |
| 69 | + id: docker_build |
| 70 | + - uses: docker/build-push-action@v2 |
| 71 | + id: docker_build |
| 72 | + with: |
| 73 | + push: true |
| 74 | + tags: ${{ steps.set-tags.outputs.tags }} |
| 75 | + context: ${{ matrix.image }} |
| 76 | + - name: Image digest |
| 77 | + run: echo ${{ steps.docker_build.outputs.digest }} |
0 commit comments