Delete .forgejo/workflows/ci-cd.yml
This commit is contained in:
parent
1a1da7b584
commit
58c9833be9
1 changed files with 0 additions and 79 deletions
|
|
@ -1,79 +0,0 @@
|
||||||
# /.forgejo/workflows/ci-cd.yml
|
|
||||||
name: Build & Deploy on Dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
|
||||||
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
|
||||||
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
|
||||||
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }}
|
|
||||||
IMAGE_VERSION: latest
|
|
||||||
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
config-inline: |
|
|
||||||
[registry."${{ env.REGISTRY }}"]
|
|
||||||
ca=["/etc/ssl/certs/ca-certificates.crt"]
|
|
||||||
- name: Tag Version
|
|
||||||
run: |
|
|
||||||
echo "IMAGE_VERSION=latest"
|
|
||||||
- name: Login in to registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ env.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ env.REGISTRY_PASSWORD }}
|
|
||||||
- name: Build and push docker image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64
|
|
||||||
context: .
|
|
||||||
file: ./docker/Dockerfile
|
|
||||||
tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
|
|
||||||
push: true
|
|
||||||
- name: Remote Deploy
|
|
||||||
uses: appleboy/ssh-action@v1.2.1
|
|
||||||
with:
|
|
||||||
host: ${{ vars.SSH_DEPLOY_HOST }}
|
|
||||||
port: ${{ vars.SSH_DEPLOY_PORT }}
|
|
||||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
|
||||||
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
|
||||||
script: |
|
|
||||||
cd ~/repo
|
|
||||||
./replace-env.sh API_ORG "${{ env.IMAGE_VERSION }}"
|
|
||||||
./deploy.sh hrms-api-org
|
|
||||||
|
|
||||||
- name: Discord Notification
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
|
||||||
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
|
||||||
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
||||||
curl -H "Content-Type: application/json" \
|
|
||||||
-X POST \
|
|
||||||
-d "{
|
|
||||||
\"embeds\": [{
|
|
||||||
\"title\": \"$STATUS\",
|
|
||||||
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\",
|
|
||||||
\"color\": $COLOR,
|
|
||||||
\"footer\": {
|
|
||||||
\"text\": \"Release Notification\",
|
|
||||||
\"icon_url\": \"https://example.com/success-icon.png\"
|
|
||||||
},
|
|
||||||
\"timestamp\": \"$TIMESTAMP\"
|
|
||||||
}]
|
|
||||||
}" \
|
|
||||||
${{ env.DISCORD_WEBHOOK }}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue