-
Notifications
You must be signed in to change notification settings - Fork 4
42 lines (35 loc) · 1.63 KB
/
main.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
name: Build images
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: olegtarasov/[email protected]
id: tagName
- uses: actions/checkout@v2
- name: Build dackup image
run: docker build -t dackup .
- name: Push the master to GitHub Package Registry
if: github.ref == 'refs/heads/master'
run: |
docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{ secrets.PACKAGES_TOKEN }}
docker tag dackup docker.pkg.github.com/huobazi/dackup/dackup:latest
docker push docker.pkg.github.com/huobazi/dackup/dackup:latest
- name: Push the tag to GitHub Package Registry
if: startsWith(github.ref, 'refs/tags/') && startsWith(steps.tagName.outputs.tag, 'v')
run: |
docker login docker.pkg.github.com -u $GITHUB_ACTOR -p ${{ secrets.PACKAGES_TOKEN }}
docker tag dackup docker.pkg.github.com/huobazi/dackup/dackup:$GIT_TAG_NAME
docker push docker.pkg.github.com/huobazi/dackup/dackup:$GIT_TAG_NAME
- name: Push the master to Docker Hub
if: github.ref == 'refs/heads/master'
run: |
docker login -u huobazi -p ${{ secrets.DOCKER_TOKEN }}
docker tag dackup huobazi/dackup:latest
docker push huobazi/dackup:latest
- name: Push the tag to Docker Hub
if: startsWith(github.ref, 'refs/tags/') && startsWith(steps.tagName.outputs.tag, 'v')
run: |
docker login -u huobazi -p ${{ secrets.DOCKER_TOKEN }}
docker tag dackup huobazi/dackup:$GIT_TAG_NAME
docker push huobazi/dackup:$GIT_TAG_NAME