-
Notifications
You must be signed in to change notification settings - Fork 29
executable file
·63 lines (57 loc) · 2.14 KB
/
build-and-push-sync-server.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
54
55
56
57
58
59
60
61
62
63
name: build-and-push-sync-server
on:
workflow_dispatch:
push:
branches:
- master
- develop
paths:
#Build and push when anki-sync-server files change
- 'services/anki-sync-server/**'
env:
ANKISYNCD_AUTH_DB_PATH: ./auth.db
ANKISYNCD_BASE_MEDIA_URL: /msync/
ANKISYNCD_BASE_URL: /sync/
ANKISYNCD_DATA_ROOT: ./collections
ANKISYNCD_SESSION_DB_PATH: ./session.db
ANKISYNCD_PORT: 27701
jobs:
build-and-push-sync-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU for multi-platform builds
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get branch name
id: extract_branch
shell: bash
# Tag master as latest, otherwise, tag as latest-BRANCH
run: echo "##[set-output name=branchtag;]$(if [ $GITHUB_REF == 'refs/heads/master' ]; then echo ''; else echo -${GITHUB_REF##*/}; fi)"
- name: Get date
id: get_date
shell: bash
run: echo "##[set-output name=datetag;]$(date +%Y%m%d)"
- name: Build for various platforms and push to Dockerhub
uses: docker/build-push-action@v2
with:
context: services/anki-sync-server/images
platforms: linux/amd64
push: true
tags: |
ankicommunity/anki-sync-server:latest${{ steps.extract_branch.outputs.branchtag }}
ankicommunity/anki-sync-server:${{ steps.get_date.outputs.datetag }}
build-args: |
ANKISYNCD_PORT=${{ env.ANKISYNCD_PORT }}
ANKISYNCD_BASE_URL=${{ env.ANKISYNCD_BASE_URL }}
ANKISYNCD_BASE_MEDIA_URL=${{ env.ANKISYNCD_BASE_MEDIA_URL }}
ANKISYNCD_AUTH_DB_PATH=${{ env.ANKISYNCD_AUTH_DB_PATH }}
ANKISYNCD_SESSION_DB_PATH=${{ env.ANKISYNCD_SESSION_DB_PATH }}
ANKISYNCD_DATA_ROOT=${{ env.ANKISYNCD_DATA_ROOT }}