Build docker image on every push

Release docker image to github
This commit is contained in:
Christoph Petrausch
2020-04-22 00:29:17 +02:00
committed by Christoph Petrausch
parent c5f6fda731
commit f0d19e17ab
4 changed files with 34 additions and 4 deletions
+17
View File
@@ -0,0 +1,17 @@
name: Docker Image CI
on:
push:
branches: ["master"]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
+5 -2
View File
@@ -1,4 +1,7 @@
on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
name: linting
jobs:
linting:
@@ -7,4 +10,4 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: actions-contrib/golangci-lint@v1
uses: actions-contrib/golangci-lint@v1
+7
View File
@@ -28,3 +28,10 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Release docker file
- name: Build the Docker image
run: docker build -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:latest -t docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:${{ github.ref }} .
- name: Login to Github
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Publish image
run: docker push docker.pkg.github.com/hikhvar/mqtt2prometheus:latest docker.pkg.github.com/hikhvar/mqtt2prometheus:${{ github.ref }}
+5 -2
View File
@@ -1,4 +1,7 @@
on: [push, pull_request]
on:
push:
branches: ["master"]
pull_request:
name: tests
jobs:
test:
@@ -17,4 +20,4 @@ jobs:
- name: Test
run: go test ./...
- name: Vet
run: go vet ./...
run: go vet ./...