deploy compose
This commit is contained in:
77
.github/workflows/deploy_compose.yml
vendored
Normal file
77
.github/workflows/deploy_compose.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
runs_on:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'ubuntu_act_on_20'
|
||||||
|
compose_repository:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ${{ github.repository }}
|
||||||
|
checkout_token:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ${{ github.token }}
|
||||||
|
ssh_proxy_cmd:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
stack_file_name:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'compose.yml'
|
||||||
|
env_file_name:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: '.env.base,.env.version'
|
||||||
|
args:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'up -d'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy_compose:
|
||||||
|
runs-on: ${{ inputs.runs_on }}
|
||||||
|
# container:
|
||||||
|
# image: catthehacker/ubuntu:act-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.compose_repository }}
|
||||||
|
token: ${{ inputs.checkout_token }}
|
||||||
|
|
||||||
|
- name: Switch Host if pr
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
echo "Set Host"
|
||||||
|
echo "github.event_name: ${{ github.event_name}}"
|
||||||
|
echo DEPLOY_HOST=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ vars.DEV_DEPLOY_HOST }}" || echo -n "${{ vars.DEPLOY_HOST }}") >> $GITHUB_OUTPUT
|
||||||
|
echo DEPLOY_USER=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ vars.DEV_DEPLOY_USER }}" || echo -n "${{ vars.DEPLOY_USER }}") >> $GITHUB_OUTPUT
|
||||||
|
echo SSH_PRIVATE_KEY=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ secrets.DEV_SSH_PRIVATE_KEY }}" || echo -n "${{ secrets.SSH_PRIVATE_KEY }}") >> $GITHUB_OUTPUT
|
||||||
|
echo WORKING_DIRECTORY=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ vars.DEV_WORKING_DIRECTORY }}" || echo -n "${{ vars.WORKING_DIRECTORY }}") >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Change Version if pr
|
||||||
|
if: ${{ github.event.pull_request }}
|
||||||
|
run: |
|
||||||
|
echo "Change Version"
|
||||||
|
echo ${{ github.repository }} |
|
||||||
|
echo ${${{ github.repository }}//${{ github.repository_owner }}\//} | sed
|
||||||
|
MODULE=$(echo ${{ github.repository }} | sed "s/${{ github.repository_owner }}\///" | sed 's/-/_/g' | tr a-z A-Z | sed 's/OLMS/VERSION/') && sed -i "s/^$MODULE=.*/$MODULE=pr-${{ github.event.number }}-head/" .env.version
|
||||||
|
|
||||||
|
- name: Deploy to Remote Host
|
||||||
|
uses: https://code.platosoft.org/infrastructure/docker-remote-deployment-action@local
|
||||||
|
with:
|
||||||
|
remote_docker_host: ${{ steps.meta.outputs.DEPLOY_HOST }}
|
||||||
|
remote_docker_user: ${{ steps.meta.outputs.DEPLOY_USER }}
|
||||||
|
ssh_private_key: ${{ steps.meta.outputs.SSH_PRIVATE_KEY }}
|
||||||
|
deploy_path: ${{ steps.meta.outputs.WORKING_DIRECTORY }}
|
||||||
|
ssh_proxy_cmd: ${{ inputs.ssh_proxy_cmd }}
|
||||||
|
stack_file_name: ${{ inputs.stack_file_name }}
|
||||||
|
env_file_name: ${{ inputs.env_file_name }}
|
||||||
|
args: ${{ inputs.args }}
|
||||||
|
docker_registry_uri: ${{ secrets.REGISTRY_HOST }}
|
||||||
|
docker_registry_username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
docker_registry_password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
2
.github/workflows/publish_docker.yml
vendored
2
.github/workflows/publish_docker.yml
vendored
@@ -1,5 +1,3 @@
|
|||||||
name: publish
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
|
|||||||
Reference in New Issue
Block a user