Pin Action patch releases to prep for Renovate #79
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: ci | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [macos-12, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
- uses: actions/[email protected] | |
with: | |
node-version: '18' | |
cache: npm | |
# Fetch third-party license notices to include in binary packages | |
- run: go install github.com/google/[email protected] | |
- name: Download third-party license files | |
run: | | |
go-licenses save ./... --ignore $(go list -m) --save_path packaging/third-party | |
chmod -R u+w packaging/third-party | |
# Build, test, and upload native extension | |
- run: npm ci --build-from-source | |
- name: Verify binding can be require()d | |
run: ./node_modules/.bin/node-pre-gyp testbinary | |
- run: ./node_modules/.bin/node-pre-gyp package | |
- uses: actions/[email protected] | |
with: | |
name: bindings-${{ matrix.os }}-amd64 | |
path: build/stage/ | |
# Cross-compile for aarch64 | |
- name: Install aarch64 build tools | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | |
echo "CXX=aarch64-linux-gnu-g++" >> "$GITHUB_ENV" | |
- run: ./node_modules/.bin/node-pre-gyp rebuild --target_arch=arm64 | |
env: | |
CGO_ENABLED: '1' | |
GOARCH: arm64 | |
- run: ./node_modules/.bin/node-pre-gyp package --target_arch=arm64 | |
- uses: actions/[email protected] | |
with: | |
name: bindings-${{ matrix.os }}-arm64 | |
path: build/stage/ | |
# Build/upload NPM package artifact | |
- run: npm pack | |
if: matrix.os == 'ubuntu-22.04' | |
- uses: actions/[email protected] | |
if: matrix.os == 'ubuntu-22.04' | |
with: | |
name: npm-package | |
path: go-text-template-napi-*.tgz | |
create-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
pattern: bindings-* | |
merge-multiple: true | |
- uses: actions/[email protected] | |
with: | |
name: npm-package | |
- run: gh release create ${{ github.ref_name }} -d --generate-notes --target ${{ github.sha }} ./${{ github.ref_name }}/*.tar.gz "./go-text-template-napi-${GITHUB_REF_NAME#v}.tgz" | |
env: | |
GH_TOKEN: ${{ github.token }} |