This commit is contained in:
parent
cd78847448
commit
41866cdaee
|
|
@ -4,6 +4,10 @@ on:
|
|||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write # Permissão para push no GHCR
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -31,24 +35,3 @@ jobs:
|
|||
run: |
|
||||
docker push ghcr.io/$GITHUB_ACTOR_LOWER/vendaweb:latest
|
||||
docker push ghcr.io/$GITHUB_ACTOR_LOWER/vendaweb:$(date +%Y%m%d%H%M)
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- name: Convert GitHub Username to Lowercase (Deploy)
|
||||
run: echo "GITHUB_ACTOR_LOWER=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: SSH into Server and Deploy
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SERVER_HOST }}
|
||||
username: ${{ secrets.SERVER_USER }}
|
||||
password: ${{ secrets.SERVER_PASSWORD }}
|
||||
script: |
|
||||
docker login ghcr.io -u "$GITHUB_ACTOR_LOWER" -p "${{ secrets.GITHUB_TOKEN }}"
|
||||
docker pull ghcr.io/$GITHUB_ACTOR_LOWER/vendaweb:latest
|
||||
docker stop vendaweb || true
|
||||
docker rm vendaweb || true
|
||||
docker run -d --name vendaweb -p 80:80 ghcr.io/$GITHUB_ACTOR_LOWER/vendaweb:latest
|
||||
|
|
|
|||
Loading…
Reference in New Issue