Hotfixes and CI/CD
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 3m51s
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 3m51s
This commit is contained in:
40
.gitea/workflows/deploy.yaml
Normal file
40
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t my-app .
|
||||
|
||||
- name: Log in to Docker registry
|
||||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||
|
||||
- name: Tag Docker image
|
||||
run: docker tag my-app my-registry/my-app:${{ github.run_number }}
|
||||
|
||||
- name: Push Docker image to registry
|
||||
run: docker push my-registry/my-app:${{ github.run_number }}
|
||||
|
||||
- name: Connect to remote host
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.REMOTE_HOST }}
|
||||
username: ${{ secrets.REMOTE_USER }}
|
||||
password: ${{ secrets.REMOTE_PASSWORD }}
|
||||
|
||||
- name: Pull and run docker compose
|
||||
run: |
|
||||
docker pull
|
||||
docker-compose up -d
|
||||
Reference in New Issue
Block a user