bragi/.drone.yml
2020-07-12 16:05:11 +08:00

115 lines
3.5 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: build
image: node
commands:
- (cd web && npm install && npm run build)
- (cd templates/ && ./translate.py)
when:
event:
- push
- name: deploy-testing
image: debian
commands:
- (cd lang && ./sync_translation.py --client $TRADUORA_W_CLIENT --secret $TRADUORA_W_SECRET --push)
- apt-get -qq update && apt-get -qq install git > /dev/null
- sed -i 's/target_version = git/target_version = testing/' configuration.default.ini
- version=$(git rev-parse HEAD)
- echo "current git commit is $version"
- echo $version > /mnt/botamusique/testing-version
- sed -i "s/version = 'git'/version = '$version'/" mumbleBot.py
- rm -rf .git*
- rm -rf web
- mkdir /tmp/botamusique
- cp -r . /tmp/botamusique/
- tar -czf /mnt/botamusique/sources-testing.tar.gz -C /tmp botamusique
volumes:
- name: repo
path: /mnt/botamusique/
when:
branch:
- master
event:
- push
- name: docker-testing
image: plugins/docker
settings:
repo: azlux/botamusique
username:
from_secret: docker_username
password:
from_secret: docker_password
tags: testing
when:
branch:
- master
event:
- push
- name: deploy-stable
image: debian
commands:
- (cd lang && ./sync_translation.py --client $TRADUORA_W_CLIENT --secret $TRADUORA_W_SECRET --push)
- apt-get -qq update && apt-get -qq install jq curl git pandoc > /dev/null
- sed -i 's/target_version = git/target_version = stable/' configuration.default.ini
- git fetch --tags
- version=$(git describe --abbrev=0 --tags)
- echo "version is $version"
- echo $version > /mnt/botamusique/version
- sed -i "s/version = 'git'/version = '$version'/" mumbleBot.py
- curl --silent "https://api.github.com/repos/azlux/botamusique/releases/latest" | jq -r '.body' | pandoc --from gfm --to html - --output - > /mnt/botamusique/changelog
- rm -rf .git*
- rm -rf web
- mkdir /tmp/botamusique
- cp -r . /tmp/botamusique/
- tar -czf /mnt/botamusique/sources-stable.tar.gz -C /tmp botamusique
volumes:
- name: repo
path: /mnt/botamusique/
when:
event:
- tag
- name: docker-stable
image: plugins/docker
settings:
repo: azlux/botamusique
username:
from_secret: docker_username
password:
from_secret: docker_password
tags: latest
when:
event:
- tag
- name: fetch-translate
image: debian
commands:
- apt update && apt install -y git python3-requests hub
- git branch bot-traduora && git checkout bot-traduora
- (cd lang/ && ./sync_translation.py --client $TRADUORA_R_CLIENT --secret $TRADUORA_R_SECRET --fetch)
- git add lang/* && git status
- git config --global user.email "github@azlux.fr" && git config --global user.name "azlux"
- "git commit -a -m 'Bot: update strings'"
- git remote set-url origin https://azlux:$GITHUB_API@github.com/azlux/botamusique/
- git push --set-upstream origin new-translations && git push
- "GITHUB_USER=\"azlux\" GITHUB_TOKEN=\"$GITHUB_API\" hub pull-request -m \"Bot: TRADUORA Update\""
when:
event:
- cron
cron:
- auto-fetch-lang
volumes:
- name: repo
host:
path: /media/raid5/data/packages/repos/apt/botamusique/