diff --git a/.github/workflows/flow-build.yml b/.github/workflows/flow-build.yml new file mode 100644 index 00000000..9d8c8258 --- /dev/null +++ b/.github/workflows/flow-build.yml @@ -0,0 +1,59 @@ +name: flow-build + +on: + push: + branches: [ "release-2.0" ] + pull_request: + branches: [ "release-2.0" ] + +jobs: + docker-buildx: + runs-on: ubuntu-latest + env: + image_name: myks + platforms: linux/amd64,linux/arm64 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + docker.io/enopsre/${{ env.image_name }} + ghcr.io/mykso/${{ env.image_name }} + tags: | + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ env.platforms }} + cache-from: type=gha + cache-to: type=gha,mode=max