From cbcd4ea92fc2990d2f7f5823c813de44f8d12bca Mon Sep 17 00:00:00 2001 From: Carlos Quintana Date: Thu, 12 May 2022 08:54:44 +0200 Subject: [PATCH] Add slack message sending + upgrade docker build process --- .github/workflows/main.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7ee85fe9..66bb9d34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,13 +102,23 @@ jobs: if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) steps: - - name: Publish to Docker Registry - uses: docker/build-push-action@v1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: simplelogin/app-ci + + - name: Login to Docker Hub + uses: docker/login-action@v2 with: - repository: simplelogin/app-ci username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - tag_with_ref: true + + - name: Build image and publish to Docker Registry + uses: docker/build-push-action@v3 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} - name: Create Sentry release uses: getsentry/action-release@v1 @@ -123,3 +133,11 @@ jobs: to: ${{ secrets.TELEGRAM_TO }} token: ${{ secrets.TELEGRAM_TOKEN }} args: Docker image pushed on ${{ github.ref }} + + - name: Post notification to Slack + uses: slackapi/slack-github-action@v1.19.0 + with: + channel-id: ${{ secrets.SLACK_CHANNEL_ID }} + slack-message: "New tag generated: ${{github.ref}}\nBuild result: ${{ job.status }}" + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}