Skip to content

Commit

Permalink
Merge pull request #101 from hnlq715/fix/action
Browse files Browse the repository at this point in the history
fix: add env log
  • Loading branch information
sysulq committed Jul 11, 2023
2 parents 0a6baf3 + 4644918 commit 7cac12b
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 129 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

updates:
- package-ecosystem: gomod
directory: /
labels:
- dependencies
schedule:
interval: daily

- package-ecosystem: "github-actions"
directory: "/"
labels:
- dependencies
schedule:
interval: "daily"
44 changes: 36 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Go

on:
push:
branches:
Expand All @@ -12,10 +12,11 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
environment: docker
strategy:
fail-fast: true
matrix:
go: ["1.19.x"]
go: ["1.20.x"]

steps:
- name: Set up Go ${{ matrix.go }}
Expand All @@ -36,9 +37,36 @@ jobs:
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Build
run: |
make
make docker
make push
if [[ -n "${{ github.ref }}" ]]; then make crossbuild release; fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image to docker.io
uses: mr-smithers-excellent/docker-build-push@v6.2
with:
registry: docker.io
image: sophos/nginx-vtx-exporter
multiPlatform: true
addLatest: false
directory: .
dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push Docker image to ghcr.io
uses: mr-smithers-excellent/docker-build-push@v6.2
with:
registry: ghcr.io
image: nginx-vtx-exporter
multiPlatform: true
addLatest: false
directory: .
dockerfile: Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Go

on:
push:
tags:
- "v**"

jobs:
build:
name: Build
runs-on: ubuntu-latest
environment: docker
strategy:
fail-fast: true
matrix:
go: ["1.20.x"]

steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3.3.0

- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image to docker.io
uses: mr-smithers-excellent/docker-build-push@v6.2
with:
registry: docker.io
image: sophos/nginx-vtx-exporter
multiPlatform: true
addLatest: true
directory: .
dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Build and push Docker image to ghcr.io
uses: mr-smithers-excellent/docker-build-push@v6.2
with:
registry: nginx-vtx-exporter
image: ghcr.io
multiPlatform: true
addLatest: true
directory: .
dockerfile: Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
21 changes: 0 additions & 21 deletions .promu.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM quay.io/prometheus/busybox:latest
MAINTAINER Sophos <hnlq.sysu@gmail.com>
LABEL Sophos <hnlq.sysu@gmail.com>

COPY nginx-vts-exporter /bin/nginx-vts-exporter
COPY ./dist/nginx-vtx-exporter_linux_amd64_v1/nginx-vtx-exporter /bin/nginx-vts-exporter
COPY docker-entrypoint.sh /bin/docker-entrypoint.sh

ENV NGINX_HOST "http://localhost"
Expand Down
78 changes: 0 additions & 78 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# nginx-vts-exporter

[![Build Status](https://travis-ci.org/hnlq715/nginx-vts-exporter.svg?branch=master)](https://travis-ci.org/hnlq715/nginx-vts-exporter)
[![Go](https://github.com/hnlq715/nginx-vts-exporter/actions/workflows/go.yml/badge.svg)](https://github.com/hnlq715/nginx-vts-exporter/actions/workflows/go.yml)
[![Docker Pulls](https://img.shields.io/docker/pulls/sophos/nginx-vts-exporter.svg)](https://hub.docker.com/r/sophos/nginx-vts-exporter)
[![Github All Releases](https://img.shields.io/github/downloads/hnlq715/nginx-vts-exporter/total.svg)](https://github.com/hnlq715/nginx-vts-exporter)
[![GitHub release](https://img.shields.io/github/release/hnlq715/nginx-vts-exporter.svg)](https://github.com/hnlq715/nginx-vts-exporter)
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

9 changes: 9 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
project_name: nginx-vtx-exporter

builds:
- main: .
id: "nginx-vtx-exporter"
binary: nginx-vtx-exporter
goos:
- linux
goarch: [amd64, arm64]

0 comments on commit 7cac12b

Please sign in to comment.