Skip to content

updates gh-actions #177

updates gh-actions

updates gh-actions #177

Workflow file for this run

name: Build & Deployment
on:
push:
branches: [ next ]
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
steps:
# Checkout the repo
- uses: actions/checkout@v4
# Setup Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build and push Docker Image
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_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/deploy-from-github@v1.1.2
with:
server: "${{ vars.CAPROVER_SERVER }}"
app: "${{ vars.APP_NAME }}"
token: "${{ secrets.APP_TOKEN }}"
image: ${{ env.IMAGE_URL }}
# Notify Telegram Bot
- name: Send Telegram Notification
uses: appleboy/telegram-action@master
if: ${{ github.ref == 'refs/heads/next' }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
🍅 *[NEXT Tomatoro]*
*Status:* ${{ job.status }}
Run #${{github.run_number}}; Event: ${{ github.event_name }}
Author: *${{github.actor}}*
Commit message: ${{ github.event.commits[0].message }}
Repository: https://github.com/${{github.repository}}
Changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
format: markdown
disable_web_page_preview: "True"
- name: Send Telegram Notification
uses: appleboy/telegram-action@master
if: ${{ github.ref == 'refs/heads/master' }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
🍅 *[PROD Tomatoro]*
*Status:* ${{ job.status }}
Run #${{github.run_number}}; Event: ${{ github.event_name }}
Author: *${{github.actor}}*
Commit message: ${{ github.event.commits[0].message }}
Repository: https://github.com/${{github.repository}}
Changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
format: markdown
disable_web_page_preview: "True"