Merge pull request #23 from lukaszbudnik/new-docker-publish-pipeline

changes to docker pipelines (autobuilds disabled on Docker Hub)
This commit is contained in:
Łukasz Budnik
2021-08-20 14:15:11 +02:00
committed by GitHub
4 changed files with 67 additions and 26 deletions

View File

@@ -1,15 +1,9 @@
name: Docker Image CI name: Docker Image CI
on: on: [push, pull_request]
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

52
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: Publish Docker image
on:
push:
branches: [main]
release:
types: [published]
jobs:
push_to_registries:
name: Push Docker image to Docker Hub and ghcr.io registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
lukasz/yosoy
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,13 +1,8 @@
name: Go name: Go
on: on: [push, pull_request]
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -16,7 +11,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.15 go-version: 1.16
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/lukaszbudnik/yosoy module github.com/lukaszbudnik/yosoy
go 1.15 go 1.16
require ( require (
github.com/gorilla/handlers v1.5.1 github.com/gorilla/handlers v1.5.1