Build and deploy 0.17.5 #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.18 | |
- 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.18 | |
- 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.18 | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: v1.10.3 | |
install-only: true | |
- run: make release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ vars.KIBBLE_DEPLOY_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.KIBBLE_DEPLOY_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ap-southeast-2 | |
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' | |
registry-url: "https://registry.npmjs.org" | |
- name: Install deps | |
working-directory: kibble-npm | |
run: npm ci | |
- name: Publish wrapper package to npm | |
working-directory: kibble-npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |