logseq/.github/workflows/build-desktop-release.yml

349 lines
10 KiB
YAML
Raw Normal View History

# This is the main desktop application release workflow for both nightly and beta/stable releases.
2021-01-29 08:43:57 +00:00
name: Build-Desktop-Release
on:
workflow_dispatch:
2021-02-01 07:17:13 +00:00
inputs:
build-target:
description: 'Build Target ("nightly"/"beta")'
type: string
2021-02-01 07:17:13 +00:00
required: true
default: "nightly"
2021-02-01 07:17:13 +00:00
git-ref:
description: "Release Git Ref"
required: true
default: "master"
is-draft:
description: 'Draft Release? '
type: boolean
required: true
default: true
is-pre-release:
description: 'Pre Release?'
type: boolean
required: true
default: true
schedule: # Every weekday at the noon (UTC) we run a scheduled nightly build
- cron: '0 12 * * MON-FRI'
env:
CLOJURE_VERSION: '1.10.1.763'
NODE_VERSION: '16'
2021-01-29 08:43:57 +00:00
jobs:
2021-02-01 10:33:14 +00:00
compile-cljs:
2021-05-24 16:34:31 +00:00
runs-on: ubuntu-18.04
2021-02-01 07:17:13 +00:00
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
2021-06-28 13:09:23 +00:00
uses: actions/setup-node@v2
2021-02-01 07:17:13 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn cache directory
uses: actions/cache@v2
# use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
2021-01-29 08:43:57 +00:00
2021-02-01 07:50:22 +00:00
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 1.8
- name: Cache clojure deps
2021-02-02 05:30:20 +00:00
uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gitlibs
key: ${{ runner.os }}-clojure-lib-${{ hashFiles('**/deps.edn') }}
2021-02-02 05:30:20 +00:00
- name: Setup clojure
uses: DeLaGuardo/setup-clojure@3.5
with:
cli: ${{ env.CLOJURE_VERSION }}
2021-02-01 07:50:22 +00:00
2021-02-01 08:54:59 +00:00
- name: Compile CLJS
2021-11-18 13:42:10 +00:00
run: yarn install && gulp build && yarn cljs:release-electron
2021-02-01 08:54:59 +00:00
- name: Retrieve tag version
id: ref
run: |
pkgver=$(node ./scripts/get-pkg-version.js "${{ github.event.inputs.build-target }}")
echo ::set-output name=version::$pkgver
2021-02-01 14:17:42 +00:00
- name: Update APP Version
run: |
sed -i 's/"version": "0.0.1"/"version": "${{ steps.ref.outputs.version }}"/g' ./package.json
2021-02-01 14:17:42 +00:00
working-directory: ./static
2021-02-01 15:05:04 +00:00
- name: Display Package.json
2021-02-01 14:17:42 +00:00
run: cat ./package.json
working-directory: ./static
- name: Save VERSION file
run: echo "${{ steps.ref.outputs.version }}" > ./VERSION
working-directory: ./static
2021-02-01 15:05:04 +00:00
- name: List Files
run: ls -al
working-directory: ./static
2021-02-01 08:54:59 +00:00
- name: Cache Static File
uses: actions/upload-artifact@v2
2021-02-01 08:54:59 +00:00
with:
name: static
path: static
2021-02-01 07:50:22 +00:00
2021-02-01 10:33:14 +00:00
build-linux:
2021-05-24 16:34:31 +00:00
runs-on: ubuntu-18.04
2021-02-01 10:33:14 +00:00
needs: [ compile-cljs ]
steps:
2021-02-01 15:05:04 +00:00
- name: Download The Static Asset
uses: actions/download-artifact@v2
2021-02-01 10:33:14 +00:00
with:
name: static
path: static
2021-02-01 10:33:14 +00:00
- name: Retrieve tag version
id: ref
run: |
pkgver=$(cat ./static/VERSION)
echo ::set-output name=version::$pkgver
2021-02-01 10:33:14 +00:00
- name: Install Node.js, NPM and Yarn
2021-06-28 13:09:23 +00:00
uses: actions/setup-node@v2
2021-02-01 10:33:14 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
2021-02-01 10:33:14 +00:00
2021-11-18 13:42:10 +00:00
# - name: Cache Node Modules
# uses: actions/cache@v2
# with:
# path: |
# **/node_modules
# key: ${{ runner.os }}-node-modules
2021-02-02 01:58:39 +00:00
2021-02-01 15:05:04 +00:00
- name: Build/Release Electron App
run: yarn install && yarn electron:make
2021-02-01 08:54:59 +00:00
working-directory: ./static
2021-02-01 07:50:22 +00:00
- name: Save artifacts
run: |
mkdir -p builds
# NOTE: save VERSION file to builds directory
cp static/VERSION ./builds/VERSION
mv static/out/make/*-*.AppImage ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.AppImage
mv static/out/make/zip/linux/x64/*-linux-x64-*.zip ./builds/Logseq-linux-x64-${{ steps.ref.outputs.version }}.zip
2021-02-01 07:17:13 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: logseq-linux-builds
path: builds
2021-02-01 10:05:11 +00:00
build-windows:
runs-on: windows-latest
2021-02-01 10:33:14 +00:00
needs: [ compile-cljs ]
2021-02-01 10:05:11 +00:00
steps:
2021-02-01 15:05:04 +00:00
- name: Download The Static Asset
uses: actions/download-artifact@v2
2021-02-01 10:05:11 +00:00
with:
name: static
path: static
2021-02-01 10:05:11 +00:00
- name: Retrieve tag version
id: ref
run: |
$env:PkgVer=$(cat ./static/VERSION)
echo "::set-output name=version::$env:PkgVer"
2021-02-01 10:05:11 +00:00
- name: Install Node.js, NPM and Yarn
2021-06-28 13:09:23 +00:00
uses: actions/setup-node@v2
2021-02-01 10:05:11 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
2021-02-01 10:05:11 +00:00
2021-11-18 13:42:10 +00:00
# - name: Cache Node Modules
# uses: actions/cache@v2
# with:
# path: |
# **/node_modules
# key: ${{ runner.os }}-node-modules
- name: Deps Electron app
run: yarn install
working-directory: ./static
- name: Fix Deps Electron app
run: yarn run postinstall
working-directory: ./static/node_modules/dugite/
2021-02-02 02:38:00 +00:00
2021-02-01 15:05:04 +00:00
- name: Build/Release Electron app
run: yarn electron:make
2021-02-01 10:05:11 +00:00
working-directory: ./static
env:
2021-11-24 09:44:05 +00:00
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
2021-02-01 10:05:11 +00:00
- name: Save Artifact
run: |
mkdir builds
mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-win-x64-${{ steps.ref.outputs.version }}.exe
2021-02-01 07:47:27 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
2021-02-01 11:45:41 +00:00
with:
name: logseq-win64-builds
path: builds
2021-02-01 07:47:27 +00:00
2021-02-01 07:17:13 +00:00
build-macos:
2021-02-01 10:33:14 +00:00
needs: [ compile-cljs ]
2021-02-01 07:17:13 +00:00
runs-on: macos-latest
2021-01-29 08:43:57 +00:00
steps:
2021-02-01 15:05:04 +00:00
- name: Download The Static Asset
uses: actions/download-artifact@v2
2021-02-01 08:54:59 +00:00
with:
name: static
path: static
2021-02-01 08:54:59 +00:00
- name: Retrieve tag version
id: ref
run: |
pkgver=$(cat ./static/VERSION)
echo ::set-output name=version::$pkgver
2021-02-01 08:54:59 +00:00
2021-02-01 15:05:04 +00:00
- name: List Static Files
2021-02-01 08:54:59 +00:00
run: ls -al ./static
2021-01-29 08:43:57 +00:00
- name: Install Node.js, NPM and Yarn
2021-06-28 13:09:23 +00:00
uses: actions/setup-node@v2
2021-01-29 08:43:57 +00:00
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn cache directory
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
2021-01-29 08:43:57 +00:00
2021-02-02 01:58:39 +00:00
- name: Signing By Apple Developer ID
uses: apple-actions/import-codesign-certs@v1
2021-02-02 01:23:31 +00:00
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
2021-11-18 13:42:10 +00:00
# - name: Cache Node Modules
# uses: actions/cache@v2
# with:
# path: |
# **/node_modules
# key: ${{ runner.os }}-node-modules
2021-02-02 01:58:39 +00:00
- name: Build/Release Electron App for x64
2021-08-20 03:54:22 +00:00
run: yarn install && yarn electron:make
2021-02-01 08:54:59 +00:00
working-directory: ./static
2021-08-20 03:54:22 +00:00
env:
APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
2021-01-29 08:43:57 +00:00
- name: Save x64 artifacts
2021-11-10 04:30:32 +00:00
run: |
mkdir -p builds
mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.dmg
mv static/out/make/zip/darwin/x64/*.zip ./builds/Logseq-darwin-x64-${{ steps.ref.outputs.version }}.zip
2021-11-10 04:30:32 +00:00
- name: Build/Release Electron App for arm64
2021-11-10 04:30:32 +00:00
run: yarn install && yarn electron:make-macos-arm64
working-directory: ./static
env:
APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
- name: Save arm64 artifacts
run: |
mv static/out/make/Logseq.dmg ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.dmg
mv static/out/make/zip/darwin/arm64/*.zip ./builds/Logseq-darwin-arm64-${{ steps.ref.outputs.version }}.zip
2021-11-10 04:30:32 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
2021-11-10 04:30:32 +00:00
with:
name: logseq-darwin-builds
path: builds
2021-06-28 13:22:01 +00:00
2021-02-01 13:08:28 +00:00
release:
# NOTE: For now, we only have beta channel to be released on Github
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build-target == 'beta') }}
needs: [ build-macos, build-linux, build-windows ]
2021-05-24 16:34:31 +00:00
runs-on: ubuntu-18.04
2021-02-01 13:08:28 +00:00
steps:
- name: Download MacOS Artifacts
uses: actions/download-artifact@v2
2021-02-01 13:08:28 +00:00
with:
name: logseq-darwin-builds
2021-02-01 13:08:28 +00:00
path: ./
- name: Download The Linux Artifacts
uses: actions/download-artifact@v2
with:
name: logseq-linux-builds
path: ./
2021-02-01 15:05:04 +00:00
- name: Download The Windows Artifact
uses: actions/download-artifact@v2
2021-02-01 13:08:28 +00:00
with:
name: logseq-win64-builds
2021-02-01 13:08:28 +00:00
path: ./
2021-02-01 15:05:04 +00:00
- name: List files
2021-02-01 13:08:28 +00:00
run: ls -rl
- name: Retrieve tag version
id: ref
run: |
pkgver=$(cat VERSION)
echo ::set-output name=version::$pkgver
- name: Generate SHA256 checksums
run: |
sha256sum *-darwin-* > SHA256SUMS.txt
sha256sum *-win-* >> SHA256SUMS.txt
sha256sum *-linux-* >> SHA256SUMS.txt
cat SHA256SUMS.txt
2021-02-01 13:08:28 +00:00
- name: Create Release Draft
uses: softprops/action-gh-release@v1
2021-02-01 13:08:28 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.ref.outputs.version }}
name: Desktop APP ${{ steps.ref.outputs.version }} (Beta Testing)
body: "TODO: Fill this changelog. Sorry for the inconvenience!"
draft: ${{ github.event.inputs.is-draft }}
prerelease: ${{ github.event.inputs.is-pre-release }}
files: |
./VERSION
./SHA256SUMS.txt
./*.zip
./*.dmg
./*.exe
./*.AppImage
2021-02-01 13:08:28 +00:00