Skip to content

fix: stabilize playwright browser fallback #13

fix: stabilize playwright browser fallback

fix: stabilize playwright browser fallback #13

Workflow file for this run

name: build-binaries
on:
push:
branches:
- main
- master
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: write
concurrency:
group: build-binaries-${{ github.ref }}
cancel-in-progress: true
env:
APP_NAME: notion2api
jobs:
build:
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: windows
goarch: amd64
ext: .exe
archive: zip
- goos: windows
goarch: arm64
ext: .exe
archive: zip
- goos: linux
goarch: amd64
ext: ""
archive: tar.gz
- goos: linux
goarch: arm64
ext: ""
archive: tar.gz
- goos: darwin
goarch: amd64
ext: ""
archive: tar.gz
- goos: darwin
goarch: arm64
ext: ""
archive: tar.gz
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Resolve version
id: version
shell: bash
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
version="${GITHUB_REF_NAME}"
else
version="${GITHUB_REF_NAME}-${GITHUB_SHA::7}"
fi
echo "value=${version}" >> "$GITHUB_OUTPUT"
- name: Build archive
shell: bash
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
BIN_EXT: ${{ matrix.ext }}
ARCHIVE_KIND: ${{ matrix.archive }}
VERSION: ${{ steps.version.outputs.value }}
run: |
set -euo pipefail
bin_name="${APP_NAME}${BIN_EXT}"
package_name="${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}"
staging_dir="dist/${package_name}"
mkdir -p "${staging_dir}"
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o "${staging_dir}/${bin_name}" ./cmd/notion2api
cp README.md "${staging_dir}/"
cp LICENSE "${staging_dir}/"
cp config.example.json "${staging_dir}/"
cp config.docker.json "${staging_dir}/"
if [[ "${ARCHIVE_KIND}" == "zip" ]]; then
(
cd dist
zip -r "${package_name}.zip" "${package_name}"
)
else
tar -C dist -czf "dist/${package_name}.tar.gz" "${package_name}"
fi
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.zip
dist/*.tar.gz
if-no-files-found: error
retention-days: 14
release:
name: Publish release assets
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Publish GitHub release assets
uses: softprops/action-gh-release@v2
with:
files: release-assets/*