Skip to content

Commit d2d01f0

Browse files
Migrate to GitHub Actions (#100)
* Add actions workflow * Update secrets for Docker push
1 parent 837d51e commit d2d01f0

File tree

2 files changed

+60
-7
lines changed

2 files changed

+60
-7
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- master
10+
create:
11+
tags:
12+
- 'v[0-9]+.[0-9]+.[0-9]+*'
13+
14+
env:
15+
DOCKER_BUILDKIT: 1
16+
17+
jobs:
18+
19+
build:
20+
name: Build Artifacts
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v2
25+
- name: Unit Tests
26+
run: make test
27+
- name: Build Prometheus-Exporter
28+
run: make nginx-prometheus-exporter
29+
- name: Build Image
30+
uses: docker/build-push-action@v1
31+
with:
32+
repository: nginx/nginx-prometheus-exporter
33+
dockerfile: build/Dockerfile
34+
path: '.'
35+
tag_with_sha: true
36+
push: false
37+
38+
publish:
39+
name: Publish Artifacts
40+
runs-on: ubuntu-latest
41+
needs: build
42+
if: github.event_name == 'create' && contains(github.ref, 'refs/tags/')
43+
steps:
44+
- name: Checkout Repository
45+
uses: actions/checkout@v2
46+
- name: Retrieve Tag
47+
id: get_version
48+
run: echo ::set-output name=GIT_TAG::$(echo ${GITHUB_REF/refs\/tags\//} | tr -d v)
49+
- name: Push Image
50+
uses: docker/build-push-action@v1
51+
with:
52+
repository: nginx/nginx-prometheus-exporter
53+
dockerfile: build/Dockerfile
54+
path: '.'
55+
username: ${{ secrets.DOCKER_USERNAME }}
56+
password: ${{ secrets.DOCKER_PASSWORD }}
57+
registry: ${{ secrets.DOCKER_REGISTRY }}
58+
tag_with_ref: false
59+
tags: latest, ${{ steps.get_version.outputs.GIT_TAG }}
60+
push: true

build/ci/Jenkinsfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)