This commit is contained in:
parent
798cb746d1
commit
78881a2ebc
@ -11,7 +11,7 @@ steps:
|
||||
image: golang
|
||||
commands:
|
||||
- mkdir dist
|
||||
- tar -czf dist/release-$DRONE_TAG.tar.gz init/simpbot.service config.yaml.sample simpbot
|
||||
- tar -czf dist/release-$DRONE_TAG-DRONE_STAGE_ARCH.tar.gz init/simpbot.service config.yaml.sample simpbot
|
||||
when:
|
||||
event: tag
|
||||
|
||||
|
46
deploy.yml
Normal file
46
deploy.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
|
||||
- name: check simpbot version
|
||||
uri:
|
||||
url: https://git.saintnet.tech/api/v1/repos/stryan/simpbot/releases?limit=1
|
||||
return_content: true
|
||||
register: simpbot_latest
|
||||
|
||||
- name: "installing simpbot {{ simpbot_latest.json.tag_name }}"
|
||||
loop: "{{ simpbot_latest.json.[0].assets }}"
|
||||
when: "'amd64.tar.gz' in item.name"
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: "{{ item.browser_download_url }}"
|
||||
dest: "/tmp/simpbot"
|
||||
keep_newer: yes
|
||||
extra_opts:
|
||||
- --strip=1
|
||||
- --no-anchored
|
||||
- simpbot
|
||||
|
||||
- name: installing simpbot binary
|
||||
copy:
|
||||
src: /tmp/simpbot/simpbot
|
||||
dest: /usr/local/bin/
|
||||
register: new_binary
|
||||
|
||||
- name: installing unit file
|
||||
copy:
|
||||
src: /tmp/simpbot/init/simpbot.service
|
||||
dest: /etc/systemd/system/simpbot.service
|
||||
register: new_unit
|
||||
|
||||
- name: reload systemd with new unit
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
when: new_unit || new_binary
|
||||
|
||||
- name: start service
|
||||
systemd:
|
||||
name: simpbot
|
||||
state: restarted
|
||||
when: new_binary
|
Loading…
Reference in New Issue
Block a user