Skip to content

Build and deploy release-it #3

Build and deploy release-it

Build and deploy release-it #3

Workflow file for this run

name: Build and deploy
run-name: Build and deploy ${{github.ref_name}}
on:
workflow_dispatch:
# release:
# types: [created]
jobs:
sanity-checks:
name: Prerelease sanity checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Ensure kibble-npm package version matches the tag
env:
WORKFLOW_REF: ${{github.ref_name}}
run: |
cd kibble-npm
NPM_PACKAGE_VERSION=`node -p 'require("./package.json").version'`
if [ "$NPM_PACKAGE_VERSION" != "$WORKFLOW_REF"" ]; then
echo "::error file=kibble-npm/package.json,title=NPM package version mismatch::Cannot publish as the package version is $NPM_PACKAGE_VERSION but the workflow tag is $WORKFLOW_REF"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.48.0
working-directory: ./kibble
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17
- name: Run tests
working-directory: ./kibble
run: make test
release:
name: Release
needs: [sanity-checks, lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
install-only: true
- run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish to NPM
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install deps
working-directory: kibble-npm
run: npm ci
- name: Publish wrapper package to npm
working-directory: kibble-npm
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: "TODO"