44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: Build and deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
IMAGE: gitea.mystmec.com/ola/boka-gasol247
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init -q
|
|
git remote add origin "https://oauth2:${{ secrets.GITEA_TOKEN }}@gitea.mystmec.com/${{ github.repository }}.git"
|
|
git fetch --depth 1 origin "${{ github.sha }}"
|
|
git checkout -q FETCH_HEAD
|
|
|
|
- name: Login to Gitea Container Registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login gitea.mystmec.com \
|
|
-u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
|
|
- name: Build image
|
|
run: |
|
|
docker build \
|
|
-t "$IMAGE:latest" \
|
|
-t "$IMAGE:${{ github.sha }}" \
|
|
.
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push "$IMAGE:latest"
|
|
docker push "$IMAGE:${{ github.sha }}"
|
|
|
|
- name: Deploy
|
|
run: |
|
|
cd /host-stacks/gas-mystmec
|
|
docker compose pull
|
|
docker compose up -d
|