Skip to content

Refactor/clarity

Refactor/clarity #760

Workflow file for this run

name: Build
on:
push:
branches: [master]
tags: ["v*"]
paths-ignore: ["**.md", "docs/**"]
pull_request:
branches: [master]
paths-ignore: ["**.md", "docs/**"]
jobs:
linter:
name: lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Checkout
uses: actions/checkout@v3
- name: Linter
run: make build
releaser:
needs: linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# - name: Set up Snapcraft
# if: startsWith(github.ref, 'refs/tags/v')
# run: |
# sudo apt-get update
# sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Tests
run: make test
# - name: Snapcraft Login
# if: success() && startsWith(github.ref, 'refs/tags/v')
# env:
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
# run: |
# snapcraft login
- name: Import GPG key
if: success() && startsWith(github.ref, 'refs/tags/v')
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
if: success() && startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GR_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
publish:
needs: releaser
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update version in package.json
run: |
sudo apt-get install jq
jq '.version = $newVal' --arg newVal ${GITHUB_REF/refs\/tags\/v/} package.json > tmp.$$.json && mv tmp.$$.json package.json
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}