diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 6f39e7c..ff53b0e 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,4 +1,4 @@ -name: Build Docker image +name: Build and publish Docker image on: push: @@ -12,42 +12,10 @@ env: REGISTRY: ghcr.io jobs: - build: + build-push: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup Buildx - uses: docker/setup-buildx-action@v1 - - # https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable - - name: Update environment variables - run: grep -v '^#' .env >> $GITHUB_ENV - - - name: Log in to the Container registry - uses: docker/login-action@v1.12.0 + - uses: valitydev/action-deploy-docker@v2 with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Construct tags / labels for an image - id: meta - uses: docker/metadata-action@v3.6.2 - with: - images: | - ${{ env.REGISTRY }}/${{ github.repository }} - tags: | - type=sha - - - name: Build and push Docker image - uses: docker/build-push-action@v2.9.0 - with: - push: ${{ github.event_name == 'push' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - SERVICE_NAME=${{ env.SERVICE_NAME }} - OTP_VERSION=${{ env.OTP_VERSION }} - THRIFT_VERSION=${{ env.THRIFT_VERSION }} + registry-username: ${{ github.actor }} + registry-access-token: ${{ secrets.GITHUB_TOKEN }}