70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'develop'
|
|
|
|
jobs:
|
|
develop:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GITEA_ACTOR: ${{ gitea.actor }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.REGISTRY_URL }}
|
|
username: ${{ secrets.AGENT_USER }}
|
|
password: ${{ secrets.AGENT_TOKEN }}
|
|
-
|
|
name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{ vars.REPOSITORY_URL }}/${{ gitea.repository }}:develop
|
|
- name: Cleanup
|
|
run: |
|
|
docker rmi ${{ vars.REPOSITORY_URL }}/${{ gitea.repository }}:develop
|
|
- name: Deploy portainer
|
|
uses: newarifrh/portainer-service-webhook@v1
|
|
with:
|
|
webhook_url: ${{ secrets.WEBHOOK_URL }}
|
|
- name: Set Discord Content
|
|
run: |
|
|
DISCORD_ID="${{ vars[format('DISCORD_ID_{0}', env.GITEA_ACTOR)] }}"
|
|
echo "DISCORD_ID: $DISCORD_ID"
|
|
|
|
# - name: Notify Discord Success
|
|
# uses: sarisia/actions-status-discord@v1
|
|
# if: success()
|
|
# with:
|
|
# webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
# status: ${{ job.status }}
|
|
# title: Build and Deploy ${{ job.status }}
|
|
# content: "test the app"
|
|
# description: Build and deploy ${{ job.status }}
|
|
# color: 0x00FF00
|
|
# username: MBG-AGENT
|
|
# nodetail: true
|
|
# avatar_url: https://gitea.tepibojonegoro.com/avatars/ab1b485ae0fcd8b618bbc36158528b64f23cd9c472442c2e5ca54a63771c1411?size=200
|
|
|
|
# - name: Notify Discord Failure
|
|
# uses: sarisia/actions-status-discord@v1
|
|
# if: failure()
|
|
# with:
|
|
# webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
# status: ${{ job.status }}
|
|
# title: Build and Deploy ${{ job.status }}
|
|
# content: "Hey <@${{ env.DISCORD_ID }}> check service failed"
|
|
# description: Build and deploy ${{ job.status }}
|
|
# color: 0xFF0000
|
|
# nodetail: true
|
|
# username: MBG-AGENT
|
|
# avatar_url: https://gitea.tepibojonegoro.com/avatars/ab1b485ae0fcd8b618bbc36158528b64f23cd9c472442c2e5ca54a63771c1411?size=200 |