Skip to content

Added type definitions for buffer. Publish to npm with tagless version. #135

Added type definitions for buffer. Publish to npm with tagless version.

Added type definitions for buffer. Publish to npm with tagless version. #135

Workflow file for this run

on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.20.x, 1.x]
os: [ubuntu-latest, windows-latest]
arch: ["", "386"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Check formatting
run: diff -u <(echo -n) <(gofmt -d .)
if: runner.os != 'Windows'
- name: Run go vet
env:
GOARCH: ${{ matrix.arch }}
run: go vet ./...
- name: Run staticcheck
uses: dominikh/staticcheck-action@v1.3.1
with:
version: "2024.1.1"
install-go: false
cache-key: ${{ matrix.go-version }}
if: ${{ matrix.go-version == '1.x' }}
- name: Run tests
env:
GOARCH: ${{ matrix.arch }}
run: go test -vet=off ./...
test-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
npm ci
npm test --workspaces
publish-types:
name: 'Publish type definitions to npm'
needs: [test, test-types]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || github.ref_name == 'master' || github.ref_name == 'type-definitions'
steps:
- uses: actions/checkout@v4
- name: Extract version
run: |
VERSION=$(echo "${{ github.ref }}" | sed 's|refs/tags/v||')
if [[ "$VERSION" == [0-9].* ]]; then
echo "version=$VERSION" >> $GITHUB_ENV
fi
- uses: './.github/actions/publish-types'
if: env.version != ''
with:
VERSION: ${{ env.version }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
publish-types-test:

Check failure on line 65 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 65
needs: [ test, test-types ]
runs-on: ubuntu-latest
if: !startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Extract version
run: |
VERSION=0.0.0-$(git log -1 --format=%cd --date=format:%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)
echo "version=$VERSION" >> $GITHUB_ENV
- uses: './.github/actions/publish-types'
if: env.version != ''
with:
VERSION: ${{ env.version }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}