diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..e5c6fb1aea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,3 @@ +on: + workflow_call: + diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 1146eb572f..25d611c068 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -4,6 +4,11 @@ on: branches: - '!develop' - '!feature/update*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build_docker: name: Build Docker image diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7947c41542..3eb4d172a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,9 +4,15 @@ on: branches: - 'develop' - 'feature/update*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + jobs: build_darwin-x64: name: Build macOS x86_64 @@ -19,7 +25,9 @@ jobs: node-version: 20 cache: "npm" - run: npm ci - - run: ./bin/build-mac-x64.sh + - run: | + ./bin/update-build-info.sh + ./bin/build-mac-x64.sh - uses: actions/upload-artifact@v4 with: name: trilium-mac-x64.zip @@ -35,7 +43,9 @@ jobs: node-version: 20 cache: "npm" - run: npm ci - - run: ./bin/build-mac-arm64.sh + - run: | + ./bin/update-build-info.sh + ./bin/build-mac-arm64.sh - uses: actions/upload-artifact@v4 with: name: trilium-mac-arm64.zip @@ -51,7 +61,9 @@ jobs: node-version: 20 cache: "npm" - run: npm ci - - run: ./bin/build-linux-x64.sh + - run: | + ./bin/update-build-info.sh + ./bin/build-linux-x64.sh - uses: actions/upload-artifact@v4 with: name: trilium-linux-x64.tar.xz @@ -71,7 +83,9 @@ jobs: node-version: 20 cache: "npm" - run: npm ci - - run: ./bin/build-server.sh + - run: | + ./bin/update-build-info.sh + ./bin/build-server.sh - uses: actions/upload-artifact@v4 with: name: trilium-linux-x64-server.tar.xz @@ -94,11 +108,13 @@ jobs: node-version: 20 cache: "npm" - run: npm ci - - run: ./bin/build-win-x64.sh + - run: | + ./bin/update-build-info.sh + ./bin/build-win-x64.sh DONTPACK - uses: actions/upload-artifact@v4 with: - name: trilium-windows-x64.zip - path: dist/trilium-windows-x64-*.zip + name: trilium-windows-x64 + path: dist/trilium-windows-x64 build_docker: name: Build Docker image runs-on: ubuntu-latest diff --git a/bin/build-win-x64.sh b/bin/build-win-x64.sh index ad359ccb62..43c96304d1 100755 --- a/bin/build-win-x64.sh +++ b/bin/build-win-x64.sh @@ -34,9 +34,11 @@ rm -rf $BUILD_DIR/dump-db/node_modules cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/ -echo "Zipping windows x64 electron distribution..." -VERSION=`jq -r ".version" package.json` - -cd dist +if [ "$1" != "DONTPACK" ] +then + echo "Zipping windows x64 electron distribution..." + VERSION=`jq -r ".version" package.json` -zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64 + cd dist + zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64 +fi \ No newline at end of file diff --git a/bin/release.sh b/bin/release.sh index 41fdd073b1..abcba3e2b7 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -32,7 +32,7 @@ mv package.json.tmp package.json git add package.json -echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts +./update-build-info.sh git add src/services/build.ts diff --git a/bin/update-build-info.sh b/bin/update-build-info.sh new file mode 100755 index 0000000000..7da2cbc685 --- /dev/null +++ b/bin/update-build-info.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts \ No newline at end of file