refactor discord code #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build & Deployment' | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@v2 | |
# Setup Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Build and push Docker Image | |
- name: Login to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Preset Image Name | |
run: echo "IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ env.IMAGE_URL }} | |
build-args: | | |
DOPPLER_TOKEN=${{ secrets.DOPPLER_TOKEN }} | |
# Deploy to CapRover | |
- name: Deploy Image to CapRover | |
uses: caprover/[email protected] | |
with: | |
server: "${{ vars.CAPROVER_SERVER }}" | |
app: "${{ vars.APP_NAME }}" | |
token: "${{ secrets.CAPROVER_APP_TOKEN }}" | |
image: ${{ env.IMAGE_URL }} | |
- name: send telegram message | |
uses: appleboy/telegram-action@master | |
if: always() | |
with: | |
to: ${{ secrets.TELEGRAM_GROUP_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
💸🤖 *[PROD Dólar en bancos bots]* | |
🧾 *Status: ${{ job.status }}* | |
#️⃣ Run # ${{github.run_number}}. Event type: *${{ github.event_name }}* | |
🤡 Developer: *${{github.actor}}* | |
🔗 Href: https://github.com/${{github.repository}} | |
✨ See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
format: markdown | |
disable_web_page_preview: "True" |