refactor: workflow
This commit is contained in:
parent
bead74e0b7
commit
dc78df47bd
4 changed files with 89 additions and 75 deletions
89
.github/workflows/gitea-local.yaml
vendored
Normal file
89
.github/workflows/gitea-local.yaml
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
name: Gitea Action
|
||||||
|
|
||||||
|
run-name: Build ${{ github.actor }}
|
||||||
|
|
||||||
|
# Intended for local gitea instance only.
|
||||||
|
|
||||||
|
on:
|
||||||
|
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 }}:latest
|
||||||
|
jobs:
|
||||||
|
gitea-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."${{ env.REGISTRY }}"]
|
||||||
|
ca=["/etc/ssl/certs/ca-certificates.crt"]
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}
|
||||||
|
push: true
|
||||||
|
- name: Remote Deploy Development
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEVELOPMENT_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEVELOPMENT_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEVELOPMENT_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEVELOPMENT_PASSWORD }}
|
||||||
|
script: eval "${{ secrets.SSH_DEVELOPMENT_DEPLOY_CMD }}" & wait
|
||||||
|
- name: Remote Deploy Test
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_TEST_HOST }}
|
||||||
|
port: ${{ vars.SSH_TEST_PORT }}
|
||||||
|
username: ${{ secrets.SSH_TEST_USER }}
|
||||||
|
password: ${{ secrets.SSH_TEST_PASSWORD }}
|
||||||
|
script: eval "${{ secrets.SSH_TEST_DEPLOY_CMD }}" & wait
|
||||||
|
- name: Notify Discord Success
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
curl -H "Content-Type: application/json" -X POST \
|
||||||
|
-d '{
|
||||||
|
"embeds": [{
|
||||||
|
"title": "✅ Gitea Local Deployment Success!",
|
||||||
|
"description": "**Details:**\n- Image: `${{ env.CONTAINER_IMAGE_NAME }}`\n- Deployed by: `${{ github.actor }}`",
|
||||||
|
"color": 3066993,
|
||||||
|
"footer": {
|
||||||
|
"text": "Gitea Local Release Notification",
|
||||||
|
"icon_url": "https://example.com/success-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
- name: Notify Discord Failure
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
curl -H "Content-Type: application/json" -X POST \
|
||||||
|
-d '{
|
||||||
|
"embeds": [{
|
||||||
|
"title": "❌ Gitea Local Deployment Failed!",
|
||||||
|
"description": "**Details:**\n- Image: `${{ env.CONTAINER_IMAGE_NAME }}`\n- Attempted by: `${{ github.actor }}`",
|
||||||
|
"color": 15158332,
|
||||||
|
"footer": {
|
||||||
|
"text": "Gitea Local Release Notification",
|
||||||
|
"icon_url": "https://example.com/failure-icon.png"
|
||||||
|
},
|
||||||
|
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
|
||||||
|
}]
|
||||||
|
}' \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK }}
|
||||||
31
.github/workflows/local-build-release.yaml
vendored
31
.github/workflows/local-build-release.yaml
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
name: local-build-release
|
|
||||||
|
|
||||||
# Intended for local network use.
|
|
||||||
# Remote access is possible if the host has a public IP address.
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ${{ vars.DOCKER_REGISTRY }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
local-build-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
config-inline: |
|
|
||||||
[registry."${{ env.REGISTRY }}"]
|
|
||||||
http = true
|
|
||||||
insecure = true
|
|
||||||
- name: Build and Push Docker Image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: ${{ env.REGISTRY }}/jws/jws-frontend:latest
|
|
||||||
allow: security.insecure
|
|
||||||
22
.github/workflows/local-release-demo.yml
vendored
22
.github/workflows/local-release-demo.yml
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
name: local-release-demo
|
|
||||||
|
|
||||||
# Intended for local network use.
|
|
||||||
# Remote access is possible if the host has a public IP address.
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
local-release-demo:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Remote deploy internal chamomind server
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
script: |
|
|
||||||
cd ~/repositories/jws-frontend
|
|
||||||
git pull
|
|
||||||
docker compose up -d --build
|
|
||||||
22
.github/workflows/local-release-dev.yml
vendored
22
.github/workflows/local-release-dev.yml
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
name: local-release-dev
|
|
||||||
|
|
||||||
# Intended for local network use.
|
|
||||||
# Remote access is possible if the host has a public IP address.
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
local-release-dev:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Remote deploy internal chamomind server
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
script: |
|
|
||||||
cd ~/repositories/jws-frontend
|
|
||||||
git pull
|
|
||||||
docker compose up -d --build
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue