updates pipeline #92
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: [ master, next ] | |
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.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: | | |
NEXT_PUBLIC_POSTHOG_KEY=${{ vars.NEXT_PUBLIC_POSTHOG_KEY }} | |
NEXT_PUBLIC_POSTHOG_HOST=${{ vars.NEXT_PUBLIC_POSTHOG_HOST }} | |
NEXT_PUBLIC_SENTRY_DSN=${{ vars.NEXT_PUBLIC_SENTRY_DSN }} | |
SENTRY_DSN=${{ vars.SENTRY_DSN }} | |
# 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" |