portfolio/.gitea/workflows/deploy.yaml
marre 8b5cca0c64
All checks were successful
ci/cd / Build (push) Successful in 12s
Update .gitea/workflows/deploy.yaml
2024-04-03 17:29:23 +02:00

29 lines
1.0 KiB
YAML

name: ci/cd
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
jobs:
Build:
runs-on: all
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Declare variables
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "run_name=$(echo "$GITHUB_REPOSITORY" | sed "s/\//_/")" >> "$GITHUB_ENV"
echo "domain_name="www.mariia.art"" >> "$GITHUB_ENV"
echo "docker_port="80"" >> "$GITHUB_ENV"
- name: Build docker
run: |
docker build -t ${{ gitea.repository }}:${{ env.sha_short }} -t ${{ gitea.repository }}:latest .
- name: Start docker
run: |
docker container rm -f ${{ env.run_name }} || true
docker run -d --network=web --restart unless-stopped --name ${{ env.run_name }} ${{ gitea.repository }}:${{ env.sha_short }}
/usr/bin/caddyconf --add --url ${{ env.domain_name }} --name ${{ env.run_name }} --port ${{ env.docker_port }}