arguments, fixes, dockerfile, ci
This commit is contained in:
79
.gitea/workflows/build_publish.yaml
Normal file
79
.gitea/workflows/build_publish.yaml
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Build and publish farmacia-bot images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build_images:
|
||||
name: Build and push client's image to Gitea's registry
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Gitea's docker registry
|
||||
uses: docker/login-action@v3.1.0
|
||||
with:
|
||||
registry: ${{ vars.hostname_gitea }}
|
||||
username: mozempk
|
||||
password: ${{ secrets.REGISTRY_GITEA_TOKEN }}
|
||||
|
||||
- name: Extract client metadata (tags, labels) for Docker
|
||||
id: meta_client
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
with:
|
||||
# this forces latest. Else it's created only if a release (tag) is created
|
||||
tags: |
|
||||
type=raw,enable=true,priority=200,prefix=,suffix=,value=latest
|
||||
images: ${{ vars.hostname_gitea }}/${{gitea.repository}}/client
|
||||
|
||||
- name: Build and push client Docker image
|
||||
id: push_client
|
||||
uses: docker/build-push-action@v5.3.0
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta_client.outputs.tags }}
|
||||
labels: ${{ steps.meta_client.outputs.labels }}
|
||||
|
||||
- name: Extract server metadata (tags, labels) for Docker
|
||||
id: meta_server
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
with:
|
||||
# this forces latest. Else it's created only if a release (tag) is created
|
||||
tags: |
|
||||
type=raw,enable=true,priority=200,prefix=,suffix=,value=latest
|
||||
images: ${{ vars.hostname_gitea }}/${{gitea.repository}}/server
|
||||
|
||||
- name: Build and push server Docker image
|
||||
id: push_server
|
||||
uses: docker/build-push-action@v5.3.0
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta_server.outputs.tags }}
|
||||
labels: ${{ steps.meta_server.outputs.labels }}
|
||||
deploy_ovh:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_images
|
||||
steps:
|
||||
- name: Deploy to OVH
|
||||
id: ovh_deploy
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USERNAME }}
|
||||
key: ${{ secrets.DEPLOY_KEY }}
|
||||
script: |
|
||||
cd ~/stacks/bot-farmacia
|
||||
docker-compose down && docker-compose pull && docker-compose up -d
|
||||
Reference in New Issue
Block a user