Skip to content

Commit 898bf82

Browse files
authored
Update CI workflow (#293)
- Uses go-version-file option in setup-go action - Sets the GOPATH variable correctly for GoReleaser - Removes unnecessary build-args from Docker build action
1 parent 5a4a70e commit 898bf82

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continuous Integration
1+
name: CI
22

33
on:
44
push:
@@ -23,7 +23,6 @@ on:
2323
env:
2424
DOCKER_PLATFORMS: "linux/arm,linux/arm64,linux/amd64,linux/ppc64le,linux/s390x,linux/mips64le,linux/386"
2525

26-
2726
jobs:
2827

2928
unit-tests:
@@ -32,12 +31,11 @@ jobs:
3231
steps:
3332
- name: Checkout Repository
3433
uses: actions/checkout@v3
35-
- name: Determine Go version from go.mod
36-
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
3734
- name: Setup Golang Environment
3835
uses: actions/setup-go@v3
3936
with:
40-
go-version: ${{ env.GO_VERSION }}
37+
go-version-file: go.mod
38+
cache: true
4139
- name: Run Tests
4240
run: make test
4341

@@ -50,12 +48,15 @@ jobs:
5048
uses: actions/checkout@v3
5149
with:
5250
fetch-depth: 0
53-
- name: Determine Go version from go.mod
54-
run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
5551
- name: Setup Golang Environment
5652
uses: actions/setup-go@v3
5753
with:
58-
go-version: ${{ env.GO_VERSION }}
54+
go-version-file: go.mod
55+
cache: true
56+
- name: Determine GOPATH
57+
id: go
58+
run: |
59+
echo "::set-output name=go_path::$(go env GOPATH)"
5960
- name: Setup QEMU
6061
uses: docker/setup-qemu-action@v2
6162
with:
@@ -123,7 +124,7 @@ jobs:
123124
args: ${{ !startsWith(github.ref, 'refs/tags/') && 'build --snapshot' || 'release' }} ${{ github.event_name == 'pull_request' && '--single-target' || '' }} --rm-dist
124125
env:
125126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126-
GOPATH: ${{ env.GOPATH }}
127+
GOPATH: ${{ steps.go.outputs.go_path }}
127128
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.NGINX_PAT }}
128129
- name: Push to Dockerhub
129130
uses: docker/build-push-action@v3
@@ -138,5 +139,3 @@ jobs:
138139
push: ${{ github.event_name != 'pull_request' }}
139140
cache-from: type=gha
140141
cache-to: type=gha,mode=max
141-
build-args: |
142-
VERSION=${{ steps.meta.outputs.version }}

.github/workflows/notifications.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_run:
55
branches: [main]
66
workflows:
7-
- "Continuous Integration"
7+
- "CI"
88
- "CodeQL"
99
- "Fossa"
1010
- "Lint"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Continuous Integration](https://github.com/nginxinc/nginx-prometheus-exporter/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-prometheus-exporter/actions?query=workflow%3A%22Continuous+Integration%22) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter.svg?type=shield)](https://app.fossa.com/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter?ref=badge_shield) [![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-prometheus-exporter)](https://goreportcard.com/report/github.com/nginxinc/nginx-prometheus-exporter) ![GitHub all releases](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/total?logo=github) ![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/latest/total?sort=semver&logo=github) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nginxinc/nginx-prometheus-exporter?logo=github&sort=semver)](https://github.com/nginxinc/nginx-prometheus-exporter/releases/latest) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/nginxinc/nginx-prometheus-exporter?logo=go) [![Docker Pulls](https://img.shields.io/docker/pulls/nginx/nginx-prometheus-exporter?logo=docker&logoColor=white)](https://hub.docker.com/r/nginx/nginx-prometheus-exporter) ![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/nginx/nginx-prometheus-exporter?logo=docker&logoColor=white&sort=semver) [![Slack](https://img.shields.io/badge/slack-%23nginx--prometheus--exporter-green?logo=slack)](https://nginxcommunity.slack.com/channels/nginx-prometheus-exporter)
1+
[![CI](https://github.com/nginxinc/nginx-prometheus-exporter/workflows/Continuous%20Integration/badge.svg)](https://github.com/nginxinc/nginx-prometheus-exporter/actions?query=workflow%3A%22Continuous+Integration%22) [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter.svg?type=shield)](https://app.fossa.com/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter?ref=badge_shield) [![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-prometheus-exporter)](https://goreportcard.com/report/github.com/nginxinc/nginx-prometheus-exporter) ![GitHub all releases](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/total?logo=github) ![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/latest/total?sort=semver&logo=github) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nginxinc/nginx-prometheus-exporter?logo=github&sort=semver)](https://github.com/nginxinc/nginx-prometheus-exporter/releases/latest) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/nginxinc/nginx-prometheus-exporter?logo=go) [![Docker Pulls](https://img.shields.io/docker/pulls/nginx/nginx-prometheus-exporter?logo=docker&logoColor=white)](https://hub.docker.com/r/nginx/nginx-prometheus-exporter) ![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/nginx/nginx-prometheus-exporter?logo=docker&logoColor=white&sort=semver) [![Slack](https://img.shields.io/badge/slack-%23nginx--prometheus--exporter-green?logo=slack)](https://nginxcommunity.slack.com/channels/nginx-prometheus-exporter)
22

33
# NGINX Prometheus Exporter
44

0 commit comments

Comments
 (0)