76 lines
2.9 KiB
YAML
76 lines
2.9 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
runs_on:
|
|
required: false
|
|
type: string
|
|
default: 'ubuntu_act_on_20'
|
|
compose_repository:
|
|
required: false
|
|
type: string
|
|
default: ${{ github.repository }}
|
|
stack_file_name:
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
env_file_name:
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
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: ${{ secrets.REPOS_ACCESS_TOKEN }}
|
|
|
|
- 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 Dev Host on pr
|
|
uses: https://code.platosoft.org/infrastructure/docker-remote-deployment-action@local
|
|
if: ${{ github.event.pull_request }}
|
|
with:
|
|
remote_docker_host: ${{ secrets.DEV_DEPLOY_HOST }}
|
|
remote_docker_user: ${{ secrets.DEV_DEPLOY_USER }}
|
|
ssh_private_key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
|
|
ssh_proxy_cmd: ${{ secrets.DEV_SSH_PROXY_CMD }}
|
|
deploy_path: ${{ secrets.DEV_WORKING_DIRECTORY }}
|
|
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 }}
|
|
|
|
- name: Deploy to Deploy Host on other event
|
|
uses: https://code.platosoft.org/infrastructure/docker-remote-deployment-action@local
|
|
if: ! ${{ github.event.pull_request }}
|
|
with:
|
|
remote_docker_host: ${{ secrets.DEPLOY_HOST }}
|
|
remote_docker_user: ${{ secrets.DEPLOY_USER }}
|
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
ssh_proxy_cmd: ${{ secrets.SSH_PROXY_CMD }}
|
|
deploy_path: ${{ secrets.WORKING_DIRECTORY }}
|
|
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 }} |