|
| 1 | +name: Image Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - test-* # make it be easier for contributors to test |
| 8 | + tags: |
| 9 | + - 'v*.*.*' |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - 'master' |
| 13 | + |
| 14 | +jobs: |
| 15 | + Build: |
| 16 | + runs-on: ubuntu-20.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - name: Docker meta for KubeSphere |
| 20 | + id: meta |
| 21 | + if: github.repository_owner == 'kubesphere' |
| 22 | + uses: docker/metadata-action@v3 |
| 23 | + with: |
| 24 | + images: | |
| 25 | + kubespheredev/s2ioperator |
| 26 | + ghcr.io/${{ github.repository_owner }}/s2ioperator |
| 27 | + tags: | |
| 28 | + type=schedule |
| 29 | + type=ref,event=branch |
| 30 | + type=ref,event=pr |
| 31 | + type=semver,pattern=v{{version}} |
| 32 | + type=semver,pattern=v{{major}}.{{minor}} |
| 33 | + type=semver,pattern=v{{major}} |
| 34 | + type=sha |
| 35 | + - name: Docker meta for Contributors |
| 36 | + id: metaContributors |
| 37 | + if: github.repository_owner != 'kubesphere' |
| 38 | + uses: docker/metadata-action@v3 |
| 39 | + with: |
| 40 | + images: | |
| 41 | + ghcr.io/${{ github.repository_owner }}/s2ioperator |
| 42 | + tags: | |
| 43 | + type=schedule |
| 44 | + type=ref,event=branch |
| 45 | + type=ref,event=pr |
| 46 | + type=semver,pattern=v{{version}} |
| 47 | + type=semver,pattern=v{{major}}.{{minor}} |
| 48 | + type=semver,pattern=v{{major}} |
| 49 | + type=sha |
| 50 | + - name: Set up QEMU |
| 51 | + uses: docker/setup-qemu-action@v1 |
| 52 | + - name: Set up Docker Buildx |
| 53 | + uses: docker/setup-buildx-action@v1 |
| 54 | + - name: Login to DockerHub |
| 55 | + if: github.event_name != 'pull_request' |
| 56 | + uses: docker/login-action@v1 |
| 57 | + with: |
| 58 | + username: ${{ secrets.DOCKER_HUB_USER }} |
| 59 | + password: ${{ secrets.DOCKER_HUB_SECRETS }} |
| 60 | + - name: Login to GHCR |
| 61 | + if: github.event_name != 'pull_request' |
| 62 | + uses: docker/login-action@v1 |
| 63 | + with: |
| 64 | + registry: ghcr.io |
| 65 | + username: ${{ github.repository_owner }} |
| 66 | + password: ${{ secrets.GHCR_TOKEN }} |
| 67 | + - name: Build and push Docker images |
| 68 | + |
| 69 | + if: github.repository_owner == 'kubesphere' |
| 70 | + with: |
| 71 | + context: . |
| 72 | + file: deploy/Dockerfile.multiarch |
| 73 | + tags: ${{ steps.meta.outputs.tags }} |
| 74 | + push: ${{ github.event_name != 'pull_request' }} |
| 75 | + labels: ${{ steps.meta.outputs.labels }} |
| 76 | + platforms: linux/amd64,linux/arm64 |
| 77 | + - name: Build and push Docker images for Contributors |
| 78 | + |
| 79 | + if: github.repository_owner != 'kubesphere' |
| 80 | + with: |
| 81 | + context: . |
| 82 | + file: deploy/Dockerfile.multiarch |
| 83 | + tags: ${{ steps.metaContributors.outputs.tags }} |
| 84 | + push: ${{ github.event_name != 'pull_request' }} |
| 85 | + labels: ${{ steps.metaContributors.outputs.labels }} |
| 86 | + platforms: linux/amd64,linux/arm64 |
0 commit comments