feat: debug image name
This commit is contained in:
parent
82493003e8
commit
052b124516
5 changed files with 72 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
name: Builds and Publish Docker Image
|
name: Build and Publish Docker Image
|
||||||
description: Define IMAGE_NAME to Git Hub env, based on repository name
|
description: Define IMAGE_NAME to Git Hub env, based on repository name
|
||||||
inputs:
|
inputs:
|
||||||
username:
|
username:
|
||||||
|
@ -18,6 +18,6 @@ runs:
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
uses: https://git.lhprovedor.com.br/leandro/forgejo-kaniko-action@v2
|
uses: https://git.lhprovedor.com.br/leandro/forgejo-kaniko-action@v2
|
||||||
with:
|
with:
|
||||||
image: ${{ env.IMAGE_NAME }}:${{ github.sha }},${{ env.IMAGE_NAME }}:latest
|
image: ${{ inputs.username }}/${{ env.IMAGE_NAME }}:${{ github.sha }},${{ inputs.username }}/${{ env.IMAGE_NAME }}:latest
|
||||||
username: ${{ inputs.username }}
|
username: ${{ inputs.username }}
|
||||||
password: ${{ inputs.password }}
|
password: ${{ inputs.password }}
|
||||||
|
|
60
.forgejo/actions/deploy-docker/action.yml
Normal file
60
.forgejo/actions/deploy-docker/action.yml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
name: Build and Publish Docker Image
|
||||||
|
description: Define IMAGE_NAME to Git Hub env, based on repository name
|
||||||
|
inputs:
|
||||||
|
ssh-private-key:
|
||||||
|
description: SSH Private Key
|
||||||
|
required: true
|
||||||
|
url-servidores:
|
||||||
|
description: URL to download servers list
|
||||||
|
required: false
|
||||||
|
default: https://gerencia.lhprovedor.com.br/servidores
|
||||||
|
staging-server:
|
||||||
|
description: Staging Server url,ssh-port.
|
||||||
|
required: false
|
||||||
|
default: demo.lhprovedor.com.br,22
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
shell: sh
|
||||||
|
run: apk add openssh curl
|
||||||
|
|
||||||
|
- name: Configure SSH
|
||||||
|
uses: webfactory/ssh-agent@v0.9.0
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ inputs.ssh-private-key }}
|
||||||
|
|
||||||
|
- name: Configure Staging Server
|
||||||
|
if: github.ref == 'refs/heads/development'
|
||||||
|
shell: sh
|
||||||
|
run: echo ${{ inputs.staging-server }} > servidores.lst
|
||||||
|
|
||||||
|
- name: Configure Production Servers
|
||||||
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
export SERVIDORES=`curl ${{ inputs.url-servidores }}`
|
||||||
|
echo "Leandro Servidores: $SERVIDORES"
|
||||||
|
echo $SERVIDORES >> servidores.lst
|
||||||
|
- name: deploy
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
for i in `cat servidores.lst`; do
|
||||||
|
IP=`echo $i | cut -d , -f 1`;
|
||||||
|
PORTA=`echo $i | cut -d , -f 2`;
|
||||||
|
echo "----------------------------------------------------------------------------------------"
|
||||||
|
echo "-- Syncing $IP:$PORTA"
|
||||||
|
ssh root@$IP -p $PORTA -o StrictHostKeyChecking=no -t "
|
||||||
|
cd /lh && docker image prune --force &&
|
||||||
|
docker-compose pull --quiet lhisp-dbupdater &&
|
||||||
|
docker-compose pull --quiet $BITBUCKET_REPO_SLUG &&
|
||||||
|
docker-compose up -d --remove-orphans --force-recreate lhisp-dbupdater
|
||||||
|
docker-compose up -d --remove-orphans --force-recreate ${{ env.IMAGE_NAME }}
|
||||||
|
" > $IP-$PORTA.log 2>&1 &
|
||||||
|
done;
|
||||||
|
wait
|
||||||
|
for i in `ls *.log`; do
|
||||||
|
echo "------------------------------------";
|
||||||
|
echo "Arquivo: $i";
|
||||||
|
cat $i;
|
||||||
|
done;
|
|
@ -13,9 +13,10 @@ runs:
|
||||||
export REPO_FULL=${{ github.repository }}
|
export REPO_FULL=${{ github.repository }}
|
||||||
export REPO_NAME=${REPO_FULL#*/}
|
export REPO_NAME=${REPO_FULL#*/}
|
||||||
|
|
||||||
if [ "${{ github.ref_name }}" != "master" && "${{ github.ref_name }}" != "main" ]; then
|
if [ "${{ github.ref_name }}" != "master" ] && [ "${{ github.ref_name }}" != "main" ]; then
|
||||||
export IMAGE_NAME=${{ inputs.username }}/$REPO_NAME-dev
|
export IMAGE_NAME=$REPO_NAME-dev
|
||||||
else
|
else
|
||||||
export IMAGE_NAME=${{ inputs.username }}/$REPO_NAME
|
export IMAGE_NAME=$REPO_NAME
|
||||||
fi
|
fi
|
||||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
||||||
|
echo "Image Name: $IMAGE_NAME, for Branch: ${{ github.ref_name }}"
|
||||||
|
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"cSpell.words": ["dbupdater", "lhprovedor", "webfactory"]
|
||||||
|
}
|
3
force-push.sh
Executable file
3
force-push.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
git add .; git commit --amend --no-edit; git push --force; git tag -d v1; git tag v1; git push --force origin v1;
|
Loading…
Add table
Add a link
Reference in a new issue