feat: update docker and pipeline

- Add workflow to publish to GHCR
- Add workflow to build Docker image
- Add zap2xmlrc config example
- Update Dockerfile to run continuously
This commit is contained in:
Jef LeCompte
2019-09-04 12:13:56 -04:00
commit e31071bda8
15 changed files with 1805 additions and 0 deletions

14
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Continuous Integration
on:
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build service
run: docker build .

23
.github/workflows/nightly-release.yaml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Nightly Release
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
jobs:
build-release:
name: Build and release Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login into GitHub Container Registry
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker image
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:nightly" .
- name: Release Docker image
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly"

34
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Release
on:
push:
branches:
- main
jobs:
build-tag-release:
name: Build, tag, and release Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup release please
uses: google-github-actions/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
changelog-path: CHANGELOG.md
package-name: zap2xml
- name: Login into GitHub Container Registry
if: ${{ steps.release.outputs.release_created }}
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker image
if: ${{ steps.release.outputs.release_created }}
run: |
docker build \
-t "ghcr.io/${GITHUB_REPOSITORY}:${{ steps.release.outputs.tag_name }}" \
-t "ghcr.io/${GITHUB_REPOSITORY}:latest" .
- name: Release Docker image
if: ${{ steps.release.outputs.release_created }}
run: |
docker push "ghcr.io/${GITHUB_REPOSITORY}:${{ steps.release.outputs.tag_name }}"
docker push "ghcr.io/${GITHUB_REPOSITORY}:latest"