Skip to content

Commit 90b5f12

Browse files
committed
chore(docker): attempt to automate docker releases
1 parent 27ebfce commit 90b5f12

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/docker-hub.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- v4
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+'
9+
10+
jobs:
11+
push_to_registry:
12+
name: Push Docker image to Docker Hub
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
18+
- name: Login to Docker Hub
19+
if: github.event_name != 'pull_request'
20+
uses: docker/login-action@v1
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v3
28+
with:
29+
images: graphile/postgraphile
30+
flavor: |
31+
latest=${{ github.ref == 'refs/heads/v4' }}
32+
tags: |
33+
type=raw,value=next
34+
type=semver,pattern={{version}}
35+
type=semver,pattern={{major}}-{{minor}}
36+
type=semver,pattern={{major}}
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v2
40+
with:
41+
context: .
42+
push: ${{ github.event_name != 'pull_request' }}
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)