#GeminiSprint #528
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |