-
Notifications
You must be signed in to change notification settings - Fork 20
54 lines (46 loc) · 1.81 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Docker
on: [push, pull_request]
# push:
# branches:
# - main
# - 'v[0-9]+*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- run: docker build -t friday:test .
- run: docker-compose -f docker-compose-test.yml up
env:
CI: true
WECHATY_PLUGIN_INTERCOM_TOKEN: dummy_intercom_token
WECHATY_PLUGIN_INTERCOM_WEBHOOK_PROXY_URL: https://smee.io/your_smee_io_proxy_url
WECHATY_PLUGIN_FRESHDESK_PORTAL_URL: https://juzibot.freshdesk.com/
WECHATY_PLUGIN_FRESHDESK_API_KEY: dummy_freshdesk_key
WECHATY_PLUGIN_FRESHDESK_WEBHOOK_PROXY_URL: https://smee.io/your_smee_io_proxy_url
WECHATY_PLUGIN_QNAMAKER_ENDPOINT_KEY: dummy
WECHATY_PLUGIN_QNAMAKER_KNOWLEDGE_BASE_ID: dummy
WECHATY_PLUGIN_QNAMAKER_RESOURCE_NAME: wechaty
# https://www.prestonlamb.com/blog/creating-a-docker-image-with-github-actions
publish:
name: Publish
needs: [build]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v[0-9]+'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build -t wechaty/friday .
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKER_PERSONAL_ACCESS_TOKEN }} | docker login -u zixia --password-stdin
- name: Deploy to Docker Hub
run: |
sudo apt-get install -y jq
TAG=$(jq -r .version < package.json | cut -d. -f1,2)
docker tag wechaty/friday "wechaty/friday:$TAG"
docker push "wechaty/friday:$TAG"
TAG=latest
docker tag wechaty/friday "wechaty/friday:$TAG"
docker push "wechaty/friday:$TAG"