Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/publish_jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Publish JSR'
description: |
This workflow serializes the build binary to Base64 and generates a JSON file with meta data about the file.
The file then gets published to JSR (@serial/cpp-bindings-linux).

on:
workflow_run:
workflows: ['Build Binary']
types:
- completed

permissions:
contents: read
id-token: write

jobs:
publish-jsr:
runs-on: ubuntu-latest

steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Setup Deno'
uses: denoland/setup-deno@v2
with:
deno-version: '2.x'

- name: 'Download artifact (binary)'
uses: actions/download-artifact@v4
with:
path: 'artifacts'
name: 'libcpp_bindings_linux_x86_64'
run-id: ${{ github.event.workflow_run.id }}

- name: 'Download artifact (JSR)'
uses: actions/download-artifact@v4
with:
path: 'artifacts'
name: 'jsr_json'
run-id: ${{ github.event.workflow_run.id }}

- name: 'Prepare files for JSR'
run: |
cp ./artifacts/jsr.json ./jsr/jsr.json
cp ./LICENSE ./jsr/LICENSE

./jsr/scripts/embed_binary.sh \
./artifacts/libcpp_bindings_linux.so \
./jsr/bin \
linux-x86_64

- name: 'Publish package to JSR'
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'
working-directory: jsr
run: |
deno publish --allow-dirty

- name: 'Publish package to JSR (dry-run)'
if: github.event.workflow_run.event == 'pull_request'
working-directory: jsr
run: |
deno publish --allow-dirty --dry-run