update deploy compose

This commit is contained in:
smf
2024-03-10 19:50:37 +08:00
parent a02c516a05
commit 8793fbf73c

View File

@@ -35,17 +35,6 @@ jobs:
repository: ${{ inputs.compose_repository }}
token: ${{ secrets.REPOS_ACCESS_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 "${{ secrets.DEV_DEPLOY_HOST }}" || echo -n "${{ secrets.DEPLOY_HOST }}") >> $GITHUB_OUTPUT
echo DEPLOY_USER=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ secrets.DEV_DEPLOY_USER }}" || echo -n "${{ secrets.DEPLOY_USER }}") >> $GITHUB_OUTPUT
echo SSH_PRIVATE_KEY=$([ "${{ github.event_name}}" == "pull_request" ] && printf '%s\n' "${{ secrets.DEV_SSH_PRIVATE_KEY }}" || printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}") >> $GITHUB_OUTPUT
echo SSH_PROXY_CMD=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ secrets.DEV_SSH_PROXY_CMD }}" || echo -n "${{ secrets.SSH_PROXY_CMD }}") >> $GITHUB_OUTPUT
echo WORKING_DIRECTORY=$([ "${{ github.event_name}}" == "pull_request" ] && echo -n "${{ secrets.DEV_WORKING_DIRECTORY }}" || echo -n "${{ secrets.WORKING_DIRECTORY }}") >> $GITHUB_OUTPUT
- name: Change Version if pr
if: ${{ github.event.pull_request }}
run: |
@@ -54,14 +43,31 @@ jobs:
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
- 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: ${{ steps.meta.outputs.DEPLOY_HOST }}
remote_docker_user: ${{ steps.meta.outputs.DEPLOY_USER }}
ssh_private_key: ${{ steps.meta.outputs.SSH_PRIVATE_KEY }}
ssh_proxy_cmd: ${{ steps.meta.outputs.SSH_PROXY_CMD }}
deploy_path: ${{ steps.meta.outputs.WORKING_DIRECTORY }}
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 }}