38 lines
1.0 KiB
YAML
38 lines
1.0 KiB
YAML
# https://docs.github.com/en/actions/reference/workflows-and-actions/variables
|
|
---
|
|
name: deploy
|
|
on:
|
|
push:
|
|
paths:
|
|
- '*.yml'
|
|
- '*.yaml'
|
|
|
|
env:
|
|
GIT_ASKPASS: ${{ vars.RUNNER_SCRIPT_DIR }}/askpass_helper.sh
|
|
GIT_TOKEN: ${{ secrets.TOKEN_SVC_CI }}
|
|
GIT_REPO: ${{ gitea.repository }}
|
|
DOCKER_STACK_NAME: aoc
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: swarm-test
|
|
steps:
|
|
- name: get repo
|
|
working-directory: /swarm
|
|
if: ${{ contains( gitea.event.head_commit.message , '!clone' ) }}
|
|
run: |
|
|
git clone $GITHUB_SERVER_URL/$GIT_REPO $DOCKER_STACK_NAME
|
|
cd
|
|
git submodule update --init
|
|
|
|
- name: update repo
|
|
working-directory: /swarm/${{ env.DOCKER_STACK_NAME }}
|
|
run: git pull
|
|
|
|
- name: stop stack
|
|
run: docker stack rm $DOCKER_STACK_NAME
|
|
|
|
- name: start stack
|
|
working-directory: /swarm/${{ env.DOCKER_STACK_NAME }}
|
|
run: docker stack deploy -c docker-compose.yml $DOCKER_STACK_NAME
|
|
if: ${{ !contains( gitea.event.head_commit.message , '!clone' ) }} |