-
-
Notifications
You must be signed in to change notification settings - Fork 23
55 lines (46 loc) · 1.72 KB
/
build.yml
File metadata and controls
55 lines (46 loc) · 1.72 KB
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
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v1
- name: Variables
id: vars
run: |
echo ::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- uses: docker/setup-qemu-action@v1
name: Set up QEMU
- uses: docker/setup-buildx-action@v1
name: Setup Docker Buildx
- uses: docker/build-push-action@v2
name: Build
with:
context: .
platforms: linux/amd64
- uses: docker/login-action@v1
name: Login to Docker Hub
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@v2
name: Push latest
if: github.ref == 'refs/heads/master'
with:
context: .
platforms: linux/amd64
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ steps.vars.outputs.REPOSITORY_NAME }}:latest
push: true
- uses: docker/build-push-action@v2
name: Push tag
if: startsWith(github.ref, 'refs/tags/v')
with:
context: .
platforms: linux/amd64
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ steps.vars.outputs.REPOSITORY_NAME }}:${{ steps.vars.outputs.SOURCE_TAG }}
push: true