Skip to content

Commit

Permalink
Migrate to GitHub Actions (#100)
Browse files Browse the repository at this point in the history
* Add actions workflow

* Update secrets for Docker push
  • Loading branch information
martialonline authored May 19, 2020
1 parent 837d51e commit d2d01f0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Continuous Integration

on:
push:
branches:
- '**'
pull_request:
branches:
- master
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

env:
DOCKER_BUILDKIT: 1

jobs:

build:
name: Build Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Unit Tests
run: make test
- name: Build Prometheus-Exporter
run: make nginx-prometheus-exporter
- name: Build Image
uses: docker/build-push-action@v1
with:
repository: nginx/nginx-prometheus-exporter
dockerfile: build/Dockerfile
path: '.'
tag_with_sha: true
push: false

publish:
name: Publish Artifacts
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'create' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Retrieve Tag
id: get_version
run: echo ::set-output name=GIT_TAG::$(echo ${GITHUB_REF/refs\/tags\//} | tr -d v)
- name: Push Image
uses: docker/build-push-action@v1
with:
repository: nginx/nginx-prometheus-exporter
dockerfile: build/Dockerfile
path: '.'
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
tag_with_ref: false
tags: latest, ${{ steps.get_version.outputs.GIT_TAG }}
push: true
7 changes: 0 additions & 7 deletions build/ci/Jenkinsfile

This file was deleted.

0 comments on commit d2d01f0

Please sign in to comment.