-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.06 KB
/
build.yaml
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
name: Build and push to dockerhub
on:
push:
branches:
- 'dev'
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Login to dockerhub
uses: docker/login-action@v2
with:
username: jobindex
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Tag image with version
id: meta
uses: docker/metadata-action@v4
with:
images: jobindex/${{ github.event.repository.name }}
tags: |
# output dev
type=ref,event=branch
# output 0.1.2
type=semver,pattern={{version}}
# output 0.1
type=semver,pattern={{major}}.{{minor}}
# disabled if major zero
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}