forgejo
This commit is contained in:
parent
6ab29e0eec
commit
dc7df3f8ff
2 changed files with 79 additions and 0 deletions
50
.forgejo/workflows/build.yml
Normal file
50
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# /.forgejo/workflows/build.yml
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
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: build
|
||||||
|
|
||||||
|
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: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- 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
|
||||||
29
.forgejo/workflows/deploy.yml
Normal file
29
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version to deploy"
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_VERSION: build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- 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_LOG "${{ inputs.version }}"
|
||||||
|
./deploy.sh hrms-api-log "${{ inputs.version }}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue