Skip to content

Commit

Permalink
Added: Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
danielunderwood committed Feb 26, 2022
1 parent 28f106b commit 43364b9
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Go

on: [push, pull_request]

jobs:
CodeQL:
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
check:
name: "Check code and dependencies"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: dominikh/[email protected]
with:
version: "2021.1.1"
- run: go vet ./...

Docker-Publish:
runs-on: ubuntu-latest
needs: [CodeQL, check]
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate image tag
run: |
export VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
ghcr.io/danielunderwood/log2http:latest
ghcr.io/danielunderwood/log2http:${{ env.VERSION }}

0 comments on commit 43364b9

Please sign in to comment.