Skip to content

Commit

Permalink
feat: add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
wernerfred committed Aug 7, 2021
1 parent 194ebe6 commit b11b7f4
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/docker-image-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker Image CI

on:
push:
branches: [master]
paths:
- "Dockerfile"
- "app/**"
pull_request:
branches: [master]
paths:
- "Dockerfile"
- "app/**"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Lint Dockerfile using hadolint
uses: burdzwastaken/hadolint-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HADOLINT_ACTION_DOCKERFILE_FOLDER: .

build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/[email protected]
- name: Build docker image
run: docker build .
42 changes: 42 additions & 0 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build current version + push to DockerHub

on:
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Docker meta
id: docker_meta
uses: docker/[email protected]
with:
images: wernerfred/docker-nilan-cts700
tags: |
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
flavor: |
latest=auto
- name: Set up QEMU
uses: docker/[email protected]
with:
image: tonistiigi/binfmt:latest
platforms: amd64
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
28 changes: 28 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create GitHub release

on:
push:
tags:
- "*.*.*"

jobs:
release:
if: github.event.base_ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: "0"

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_NILAN_CTS700 }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ""
draft: false
prerelease: false

0 comments on commit b11b7f4

Please sign in to comment.