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