|
|
|
name: Release
|
|
|
|
# This workflow is triggered manually
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version_bump_type:
|
|
|
|
description: 'Version Bump Type (major, minor, patch)'
|
|
|
|
required: true
|
|
|
|
default: 'patch'
|
|
|
|
version_metadata_path:
|
|
|
|
description: 'Path to file containing Version string'
|
|
|
|
required: true
|
|
|
|
default: 'webapp/backend/pkg/version/version.go'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: techknowlogick/xgo:go-1.13.x
|
|
|
|
# Service containers to run with `build` (Required for end-to-end testing)
|
|
|
|
services:
|
|
|
|
influxdb:
|
|
|
|
image: influxdb:2.2
|
|
|
|
env:
|
|
|
|
DOCKER_INFLUXDB_INIT_MODE: setup
|
|
|
|
DOCKER_INFLUXDB_INIT_USERNAME: admin
|
|
|
|
DOCKER_INFLUXDB_INIT_PASSWORD: password12345
|
|
|
|
DOCKER_INFLUXDB_INIT_ORG: scrutiny
|
|
|
|
DOCKER_INFLUXDB_INIT_BUCKET: metrics
|
|
|
|
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: my-super-secret-auth-token
|
|
|
|
ports:
|
|
|
|
- 8086:8086
|
|
|
|
env:
|
|
|
|
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
|
|
|
|
CGO_ENABLED: 1
|
|
|
|
steps:
|
|
|
|
- name: Git
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y software-properties-common
|
|
|
|
add-apt-repository ppa:git-core/ppa && apt-get update && apt-get install -y git
|
|
|
|
git --version
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Bump version
|
|
|
|
id: bump_version
|
|
|
|
uses: packagrio/action-bumpr-go@master
|
|
|
|
with:
|
|
|
|
version_bump_type: ${{ github.event.inputs.version_bump_type }}
|
|
|
|
version_metadata_path: ${{ github.event.inputs.version_metadata_path }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} # Leave this line unchanged
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
mkdir -p $(dirname "$PROJECT_PATH")
|
|
|
|
cp -a $GITHUB_WORKSPACE $PROJECT_PATH
|
|
|
|
cd $PROJECT_PATH
|
|
|
|
|
|
|
|
go mod vendor
|
|
|
|
go test -v -tags "static" $(go list ./... | grep -v /vendor/)
|
|
|
|
|
|
|
|
- name: Build Binaries
|
|
|
|
run: |
|
|
|
|
|
|
|
|
cd $PROJECT_PATH
|
|
|
|
make all
|
|
|
|
|
|
|
|
# restore modified dir to GH workspace.
|
|
|
|
cp -arf $PROJECT_PATH/. $GITHUB_WORKSPACE/
|
|
|
|
|
|
|
|
# copy all the build artifacts to the GH workspace
|
|
|
|
cp -arf /build/. $GITHUB_WORKSPACE/
|
|
|
|
|
|
|
|
- name: Commit Changes
|
|
|
|
id: commit
|
|
|
|
uses: packagrio/action-releasr-go@master
|
|
|
|
env:
|
|
|
|
# This is necessary in order to push a commit to the repo
|
|
|
|
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} # Leave this line unchanged
|
|
|
|
with:
|
|
|
|
version_metadata_path: ${{ github.event.inputs.version_metadata_path }}
|
|
|
|
- name: Publish Release
|
|
|
|
id: publish
|
|
|
|
uses: packagrio/action-publishr-go@master
|
|
|
|
env:
|
|
|
|
# This is necessary in order to push a commit to the repo
|
|
|
|
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }} # Leave this line unchanged
|
|
|
|
with:
|
|
|
|
version_metadata_path: ${{ github.event.inputs.version_metadata_path }}
|
|
|
|
upload_assets:
|
|
|
|
scrutiny-web-linux-amd64
|
|
|
|
scrutiny-collector-metrics-linux-amd64
|
|
|
|
scrutiny-web-linux-arm64
|
|
|
|
scrutiny-collector-metrics-linux-arm64
|
|
|
|
scrutiny-web-linux-arm-5
|
|
|
|
scrutiny-collector-metrics-linux-arm-5
|
|
|
|
scrutiny-web-linux-arm-6
|
|
|
|
scrutiny-collector-metrics-linux-arm-6
|
|
|
|
scrutiny-web-linux-arm-7
|
|
|
|
scrutiny-collector-metrics-linux-arm-7
|
|
|
|
scrutiny-web-windows-4.0-amd64.exe
|
|
|
|
scrutiny-collector-metrics-windows-4.0-amd64.exe
|