Skip to content

Fixes on synchronization page #281

Fixes on synchronization page

Fixes on synchronization page #281

Workflow file for this run

# GitHub Action to build a self-contained binary of the toolkit
---
name: "Build & Release"
on:
push:
branches: [main]
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
env:
HASH_FILENAME_WINDOWS: ucrtool-windows.hash
HASH_FILENAME_MAC: ucrtool-macos.hash
HASH_FILENAME: ucrtool-ubuntu.hash
jobs:
build-windows:
runs-on: windows-latest
strategy:
matrix:
node-version: [ '22.x' ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# History of 200 should be more than enough to calculate commit count since last release tag.
fetch-depth: 200
- name: Fetch all tags to determine version
run: |
chcp 65001 #set code page to utf-8
git fetch origin +refs/tags/*:refs/tags/*
echo VERSION="v$(jq .version -r package.json)" >> $env:GITHUB_ENV
#echo "VERSION=$(git describe --match "v[0-9]*" --tags HEAD --always)" >> $env:GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build Angular
run: |
npm i
# npm run test:ci
# npm run build:ci
npm run-script build
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build node JS
run: |
cd server
npm ci
echo "Building NodeJS app to bundle compatible with CommonJS format for executable injection"
npx esbuild --format=cjs --target=node22 --platform=node --bundle --outfile=bundle.js app.js
echo "Creating blob for injection"
node --experimental-sea-config sea-config.json
node -e "require('fs').copyFileSync(process.execPath, 'ucrtool-server.exe')"
echo "Injecting blob in NodeJS executable"
npx postject ucrtool-server.exe NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
# signtool remove /s ucrtool-server.exe
# signtool sign /fd SHA256 ucrtool-server.exe
- name: Prepare artifacts
shell: bash
run: |
mkdir -p artifacts
cp server/ucrtool-server.exe artifacts/
cp -r server/public artifacts/
echo "ARTIFACT_NAME=ucrtool-${{ env.VERSION }}-windows" >> $GITHUB_ENV
- name: Create upload artifact
run: |
Compress-Archive -Path ${{ github.workspace }}/artifacts/* -Destination ${{ env.ARTIFACT_NAME }}.zip
- uses: actions/upload-artifact@v4
id: upload_artifact
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.zip
if-no-files-found: error
retention-days: 3
build-macos:
runs-on: macos-latest
strategy:
matrix:
node-version: [ '22.x']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# History of 200 should be more than enough to calculate commit count since last release tag.
fetch-depth: 200
- name: Fetch all tags to determine version
run: |
git fetch origin +refs/tags/*:refs/tags/*
echo VERSION="v$(jq .version -r package.json)" >> $GITHUB_ENV
# echo "VERSION=$(git describe --match "v[0-9]*" --tags HEAD --always)" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build Angular
run: |
npm i
# npm run test:ci
# npm run build:ci
npm run-script build
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build node JS
run: |
cd server
npm ci
echo "Building NodeJS app to bundle compatible with CommonJS format for executable injection"
npx esbuild --format=cjs --target=node22 --platform=node --bundle --outfile=bundle.js app.js
echo "Creating blob for injection"
node --experimental-sea-config sea-config.json
cp $(command -v node) ucrtool-server
codesign --remove-signature ucrtool-server
echo "Injecting blob in NodeJS executable"
npx postject ucrtool-server NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA
codesign --sign - ucrtool-server
- name: Prepare artifacts
shell: bash
run: |
mkdir -p artifacts
cp server/ucrtool-server artifacts/
cp -r server/public artifacts/
echo "ARTIFACT_NAME=ucrtool-${{ env.VERSION }}-macos" >> $GITHUB_ENV
- name: Create upload artifact
shell: bash
run: |
tar czvf ${{ env.ARTIFACT_NAME }}.tar.gz -C ${GITHUB_WORKSPACE}/artifacts .
ls -lah
- uses: actions/upload-artifact@v4
id: upload_artifact
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.tar.gz
if-no-files-found: error
retention-days: 3
build-ubuntu:
runs-on: ubuntu-latest
environment: Ubuntu
strategy:
matrix:
node-version: [ '22.x']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# History of 200 should be more than enough to calculate commit count since last release tag.
fetch-depth: 200
- name: Fetch all tags to determine version
run: |
git fetch origin +refs/tags/*:refs/tags/*
echo VERSION="v$(jq .version -r package.json)" >> $GITHUB_ENV
# echo "VERSION=$(git describe --match "v[0-9]*" --tags HEAD --always)" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build Angular
run: |
npm i
# npm run test:ci
# npm run build:ci
npm run-script build
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build node JS
run: |
cd server
npm ci
echo "Building NodeJS app to bundle compatible with CommonJS format for executable injection"
npx esbuild --format=cjs --target=node22 --platform=node --bundle --outfile=bundle.js app.js
echo "Creating blob for injection"
node --experimental-sea-config sea-config.json
cp $(command -v node) ucrtool-server
echo "Injecting blob in NodeJS executable"
npx postject ucrtool-server NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
node --experimental-sea-config sea-config.json
# - name: Build docker image
# run : |
# docker login --username albaintor --password ${{ secrets.GH_PAT }} ghcr.io
# docker build . --tag ghcr.io/albaintor/ucr-tool:latest
# docker push ghcr.io/albaintor/ucr-tool:latest
#
# - name: Build and push Docker image
# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
# with:
# context: .
# args: username=albaintor,password=${{ secrets.GH_PAT }}
# file: Dockerfile
# platforms: ${{ matrix.platforms }}
# push: true
# outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Unfolded Circle Toolkit
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/uc-tool:latest
- name: Prepare artifacts
shell: bash
run: |
mkdir -p artifacts
cp server/ucrtool-server artifacts/
cp -r server/public artifacts/
echo "ARTIFACT_NAME=ucrtool-${{ env.VERSION }}-aarch64" >> $GITHUB_ENV
- name: Create upload artifact
shell: bash
run: |
tar czvf ${{ env.ARTIFACT_NAME }}.tar.gz -C ${GITHUB_WORKSPACE}/artifacts .
ls -lah
- uses: actions/upload-artifact@v4
id: upload_artifact
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}.tar.gz
if-no-files-found: error
retention-days: 3
# npx postject server NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
release:
name: Create Release
if: github.ref == 'refs/heads/main' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [build-windows, build-ubuntu, build-macos]
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: ucrtool-*
- name: Extract build archives from downloaded files
run: |
ls -R
# extract tar.gz build archives from downloaded artifacts
# (wrapped in tar from actions/upload-artifact, then extracted into a directory by actions/download-artifact)
for D in *
do if [ -d "${D}" ]; then
mv $D/* ./
fi
done;
# Use a common timestamp for all matrix build artifacts
- name: Get timestamp
run: |
echo "TIMESTAMP=$(date +"%Y%m%d_%H%M%S")" >> $GITHUB_ENV
# Add timestamp to development builds
- name: Create GitHub development build archives
if: "!contains(github.ref, 'tags/v')"
run: |
# append timestamp
for filename in *.zip; do mv $filename "$(basename $filename .zip)-${{ env.TIMESTAMP }}.zip"; done;
for filename in *.zip; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME_WINDOWS }}; done;
for filename in *aarch64.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
for filename in *macos.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME_MAC }}; done;
for filename in *.tar.gz; do mv $filename "$(basename $filename .tar.gz)-${{ env.TIMESTAMP }}.tar.gz"; done;
- name: Create Pre-Release
uses: "marvinpinto/action-automatic-releases@latest"
if: "!contains(github.ref, 'tags/v')"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
*.zip
*.tar.gz
${{ env.HASH_FILENAME_WINDOWS }}
${{ env.HASH_FILENAME }}
- name: Create GitHub release archives
if: "contains(github.ref, 'tags/v')"
run: |
for filename in *.zip; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME_WINDOWS }}; done;
for filename in *.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
if: "contains(github.ref, 'tags/v')"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
*.tar.gz
*.zip
${{ env.HASH_FILENAME_WINDOWS }}
${{ env.HASH_FILENAME }}
${{ env.HASH_FILENAME_MAC }}