Skip to content

Commit

Permalink
Merge pull request #116 from nspcc-dev/release-workflow
Browse files Browse the repository at this point in the history
Release workflow
  • Loading branch information
roman-khimov authored Feb 16, 2024
2 parents c7e72ef + c0b1d85 commit eecad7e
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,71 @@ on:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
push:
# Build for the master branch.
branches:
- master
release:
# Publish released commit as Docker `latest` and `git_revision` images.
types:
- published
workflow_dispatch:
inputs:
ref:
description: 'Ref to build the binary [default: latest master; examples: v0.10.0, 0a4ff9d3e4a9ab432fd5812eb18c98e03b5a7432]'
required: false
default: ''

jobs:
build_cli:
name: Build CLI
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
cache: true
go-version: 1.21

- name: Check version
run: if [[ $(make version) == *"dirty"* ]]; then exit 1; fi

- name: Build CLI
run: make

- name: Check version
run: if [[ $(make version) == *"dirty"* ]]; then exit 1; fi
- name: Rename CLI binary
run: mv ./bin/neo-exporter* ./bin/neo-exporter-linux-amd64

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: neo-exporter
path: ./bin/neo-exporter*
if-no-files-found: error

- name: Attach binary to the release as an asset
if: ${{ github.event_name == 'release' }}
run: gh release upload ${{ github.event.release.tag_name }} ./bin/neo-exporter-linux-amd64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_image:
needs: build_cli
name: Build Docker image
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
cache: true
go-version: 1.21
Expand Down

0 comments on commit eecad7e

Please sign in to comment.