feat: add deploy scripts on workflows
This commit is contained in:
parent
74080a9e26
commit
1364d02816
64
.gitea/workflows/integration-deploy.yaml
Normal file
64
.gitea/workflows/integration-deploy.yaml
Normal file
@ -0,0 +1,64 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_IMAGE }}:${{ gitea.sha }}
|
||||
|
||||
update-deployment:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# 이 Repository에 업로드된 helm과 유사하게
|
||||
repository: ${{ secrets.DEPLOYMENT_REPOSITORY }}
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
ref: ${{ secrets.DEPLOYMENT_BRANCH }}
|
||||
|
||||
- name: Update Image Tag
|
||||
run: |
|
||||
yq e '${{ secrets.TRIGGER_PROPS }} = "${{ gitea.sha }}"' -i ${{ secrets.TRIGGER_PATH }}
|
||||
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config --local user.name "Gitea Action"
|
||||
git config --local user.email "actions@gitea.local"
|
||||
git add ${{ secrets.TRIGGER_PATH }}
|
||||
if ! git diff --staged --quiet; then
|
||||
echo "Changes detected, committing..."
|
||||
git commit -m "Update trigger props to ${{ gitea.sha }} for deployment"
|
||||
git push
|
||||
else
|
||||
echo "No changes detected, skipping commit."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_IMAGE }}:${{ gitea.sha }}
|
||||
Loading…
x
Reference in New Issue
Block a user