Skip to content

Publish

Publish #4

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
prerelease:
type: boolean
default: false
description: mark as a prerelease
jobs:
swig:
name: Generate the SWIG wrappers
uses:
./.github/workflows/swig.yml
build-native:
name: Build native ${{ matrix.platform && '' || '' }}
needs: swig
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-20.04
id: linux-x64
- platform: macos-latest
id: darwin-arm64
- platform: macos-12
id: darwin-x64
- platform: windows-2019
id: win32-x64
uses:
./.github/workflows/build.yml
with:
platform: ${{ matrix.platform }}
native: true
wasm: false
id: ${{ matrix.id }}
enable_tiff: true
build-wasm:
name: Build WASM
needs: swig
uses:
./.github/workflows/build.yml
with:
platform: ubuntu-latest
native: false
wasm: true
enable_tiff: true
inline_projdb: false
id: emscripten-wasm32
create-release:
name: Create the Github release
runs-on: ubuntu-latest
needs: [ build-native, build-wasm ]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: ${{ inputs.prerelease }}
pack-prebuilt-binaries:
name: Pack the prebuilt binaries
runs-on: ubuntu-latest
needs: [ create-release ]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [linux-x64, win32-x64, darwin-x64, darwin-arm64, emscripten-wasm32]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download the artifact for ${{ matrix.platform }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.platform }}
path: lib/binding
- name: Pack
run:
tar -zcvf ${{ matrix.platform }}.tar.gz lib/binding
- name: Publish
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ matrix.platform }}.tar.gz
updateOnlyUnreleased: true
omitDraftDuringUpdate: true
omitPrereleaseDuringUpdate: true
create-npm-package:
name: Create the npm package
runs-on: ubuntu-latest
needs: [ build-native, build-wasm ]
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Download the SWIG-generated wrappers
uses: actions/download-artifact@v4
with:
name: swig-generated
path: swig
- run: npm pack
- name: Get version
id: version
run: node -p '"version=" + require("./package.json").version' >> "$GITHUB_OUTPUT"
- name: Upload the npm package
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: proj.js-${{ steps.version.outputs.version }}.tgz
updateOnlyUnreleased: true
omitDraftDuringUpdate: true
omitPrereleaseDuringUpdate: true
publish-release:
name: Publish the Github release
runs-on: ubuntu-latest
needs: [ create-npm-package, pack-prebuilt-binaries ]
steps:
- name: Publish the draft release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitDraftDuringUpdate: false
draft: false
omitPrereleaseDuringUpdate: true
test_package:
name: Test the npm package
uses: ./.github/workflows/test-package.yml
needs: [ publish-release, create-npm-package ]
with:
package: proj.js-${{ needs.create-npm-package.outputs.version }}.tgz
download: true