Skip to content
Merged
Show file tree
Hide file tree
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
112 changes: 112 additions & 0 deletions .github/workflows/jamscribe_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: JamScribe release

on:
push:
branches:
- "*"
workflow_dispatch:
inputs:
ref:
description: 'Ref to use in application repo'
required: false
default: 'main'
# repository_dispatch:
# types: [ build-remote ]

env:
TARGET_BRANCH: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref != '' && github.event.inputs.ref || github.event_name == 'repository_dispatch' && github.event.client_payload.sha != '' && github.event.client_payload.sha || 'main' }}

jobs:
release-jamscribe:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install zipcmp
run: sudo apt-get update && sudo apt-get install -y zipcmp

- name: Checkout songdrive-releases repo into `.github/composite-actions`
uses: actions/checkout@v3
with:
repository: jamtools/songdrive-releases
path: .github/composite-actions
ref: dev

- name: Run build composite action
uses: ./.github/composite-actions/.github/actions/build_app
with:
entrypoint: src/index.tsx

- name: Create dist.zip
run: |
cd dist
zip -r ../dist.zip .

- name: Find latest matching release by tag prefix
id: find_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PREFIX="vjamscribe-"
latest=$(gh release list --repo "${{ github.repository }}" --limit 100 --json tagName,publishedAt \
| jq -r --arg prefix "$PREFIX" '
map(select(.tagName | startswith($prefix)))
| sort_by(.publishedAt)
| last
| if . == null then "none" else .tagName[1:] end
')
echo "latest_tag=$latest" >> $GITHUB_OUTPUT

- name: Download artifact from latest release
if: steps.find_release.outputs.latest_tag != 'none'
uses: blauqs/actions-download-asset@master
with:
repo: ${{ github.repository }}
version: ${{ steps.find_release.outputs.latest_tag }}
file: dist.zip
out: previous_release.zip
token: ${{ secrets.GITHUB_TOKEN }}

- name: Compare ZIP files using zipcmp
id: compare_zips
run: |
if [[ "${{ steps.find_release.outputs.latest_tag }}" == "none" ]]; then
echo "match=false" >> $GITHUB_OUTPUT
else
if zipcmp dist.zip previous_release.zip; then
echo "match=true" >> $GITHUB_OUTPUT
else
echo "match=false" >> $GITHUB_OUTPUT
fi
fi

- name: Set version number
id: version
run: |
if [[ "${{ steps.find_release.outputs.latest_tag }}" != "none" ]]; then
# Extract number from the tag and increment
current=$(echo "${{ steps.find_release.outputs.latest_tag }}" | grep -o '[0-9]\+')
echo "new_release_number=$((current + 1))" >> $GITHUB_OUTPUT
else
echo "new_release_number=1" >> $GITHUB_OUTPUT
fi

- name: Create new release
if: steps.compare_zips.outputs.match == 'false'
uses: ncipollo/release-action@v1
with:
tag: vjamscribe-${{ steps.version.outputs.new_release_number }}
name: JamScribe v${{ steps.version.outputs.new_release_number }}
body: Automated release
artifacts: dist.zip
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: true

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: jamscribe-dist
path: dist.zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node-linker=hoisted
strict-peer-dependencies=false
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "jamscribe",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"dev": "sb dev src/index.tsx",
"build": "sb build src/index.tsx"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@jamtools/core": "0.15.0-rc20",
"@springboardjs/data-storage": "0.15.0-rc20",
"@springboardjs/platforms-browser": "0.15.0-rc20",
"@springboardjs/platforms-node": "0.15.0-rc20",
"hono": "4.7.6",
"react": "^19.1.0",
"springboard": "0.15.0-rc20",
"springboard-cli": "0.15.0-rc20",
"springboard-server": "0.15.0-rc20"
},
"devDependencies": {
"@types/react": "^19.1.2"
}
}
Loading
Loading