From ce0872f470d53f925acdad872e67b7fba246eca9 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 25 Jul 2023 10:51:50 +0200 Subject: [PATCH 1/5] feat(#6): adjust targets for general macos & linux --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0baa8e5..7c69446d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "scripts": "dist/**/*.js", "assets": "static/**/*", "targets": [ - "latest-macos-arm64" + "latest-macos", "latest-linux" ], "outputPath": "bin" }, From 6fb6e434391bd7c471674a9c6188b3cb5edac012 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 25 Jul 2023 11:11:02 +0200 Subject: [PATCH 2/5] feat(#6): build script --- build.sh | 17 +++++++++++++++++ package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..92275e54 --- /dev/null +++ b/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +cd `dirname $0` + +rm -rf bin + +node_modules/.bin/tsc --project . \ + && node_modules/.bin/pkg . \ + || exit 1 + +mkdir bin/macos +mv bin/vivify-server-macos bin/macos/vivify-server +cp viv bin/macos/viv + +mkdir bin/linux +mv bin/vivify-server-linux bin/linux/vivify-server +cp viv bin/linux/viv diff --git a/package.json b/package.json index 7c69446d..57fc7524 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev-prog": "VIV_CMD='./node_modules/.bin/ts-node ./src/app.ts' ./viv", "dev": "VIV_TIMEOUT=0 nodemon --exec ts-node ./src/app.ts", - "build": "tsc --project . && pkg .", + "build": "./build.sh", "lint": "eslint src static" }, "bin": "dist/app.js", From 40ed1847761e5533317f98b96c306ce4dcdd7d45 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 25 Jul 2023 11:11:41 +0200 Subject: [PATCH 3/5] feat(#6): build artifacts --- .github/workflows/ci.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e37e00f6..6ac2fddb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,3 +19,11 @@ jobs: - uses: actions/checkout@v3 - run: yarn - run: yarn build + - uses: actions/upload-artifact@v3 + with: + name: macos-${{ github.sha }} + path: bin/macos + - uses: actions/upload-artifact@v3 + with: + name: linux-${{ github.sha }} + path: bin/linux From 1fda2ab0bc6d3aa7938adff51c7a2841c5839031 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 25 Jul 2023 11:39:58 +0200 Subject: [PATCH 4/5] feat(#6): release workflow --- .github/workflows/ci.yaml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6ac2fddb..01185d92 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,6 +2,9 @@ name: CI on: push +permissions: + contents: write + jobs: lint: name: Lint @@ -16,14 +19,20 @@ jobs: needs: [lint] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - run: yarn - - run: yarn build - - uses: actions/upload-artifact@v3 - with: - name: macos-${{ github.sha }} - path: bin/macos - - uses: actions/upload-artifact@v3 + - name: checkout + uses: actions/checkout@v3 + - name: build + run: | + yarn + yarn build + - name: package + if: startsWith(github.ref, 'refs/tags/v') + run: | + zip -r vivify-macos-${{ github.ref_name }}.zip bin/macos/* + zip -r vivify-linux-${{ github.ref_name }}.zip bin/linux/* + - name: release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v1 with: - name: linux-${{ github.sha }} - path: bin/linux + generate_release_notes: true + files: vivify-*.zip From ddd042ec22aff229918fbba3ad213620d254e3a0 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Tue, 25 Jul 2023 12:25:44 +0200 Subject: [PATCH 5/5] feat(#6): release versioning script --- package.json | 1 - release.sh | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 release.sh diff --git a/package.json b/package.json index 57fc7524..30458e74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "vivify-server", - "version": "0.0.1", "repository": "https://github.com/jannis-baum/vivify.git", "author": "Jannis Baum", "scripts": { diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..d5230170 --- /dev/null +++ b/release.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ "$1" != "minor" -a "$1" != "major" ]; then + echo "Specify increment minor|major." + exit 1 +fi + +version="v0.0.0" +prev=$(git tag --sort=version:refname | tail -1) + +if [ -n "$prev" ]; then + prefix=$(cut -d. -f1 <<< $prev) + major=$(cut -d. -f2 <<< $prev) + + [ "$1" = "minor" ] && minor=$(bc <<< "$(cut -d. -f3 <<< $prev) + 1") + [ "$1" = "major" ] && major=$(bc <<< "$major + 1") && minor="0" + + version="$prefix.$major.$minor" +fi + +git tag -s -a $version +git push origin $version