Skip to content

OS Builds on version #80

OS Builds on version

OS Builds on version #80

Workflow file for this run

name: OS Builds on version
on:
push:
tags:
- 'v*'
workflow_dispatch:
defaults:
run:
working-directory: ./
jobs:
get-app-version:
name: Get App Version
runs-on: ubuntu-latest
outputs:
app-version: ${{steps.get-app-version.outputs.current-version}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get NPM Version
id: get-app-version
uses: martinbeentjes/npm-get-version-action@main
sync-electron-app-version:
name: Sync Electron App Version
needs: get-app-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Sync
run: |
npx --yes bun run ./automation/sync-electron-package-version.ts
- name: Commit and push
run: |
if [[ $(git status -s) ]]; then
# Changes are present
# Stage all changes
git config --local user.email "[email protected]"
git config --local user.name "FreePhoenix888"
git add electron/package.json
git commit -m "Sync electron package version"
git push origin main
else
# No changes in the working directory
echo "No changes in the working directory."
fi
linux-build:
name: Linux Build
needs: [get-app-version,sync-electron-app-version]
env:
USE_HARD_LINKS: false
MIGRATIONS_DIR: /tmp/.migrate
ASSET_PREFIX: '.'
npm_config_yes: true
NEXT_PUBLIC_ENGINES: 1
MIGRATIONS_ID_TYPE_SQL: bigint
MIGRATIONS_ID_TYPE_GQL: bigint
MIGRATIONS_HASURA_PATH: localhost:8080
MIGRATIONS_HASURA_SSL: 0
MIGRATIONS_HASURA_SECRET: myadminsecretkey
NEXT_PUBLIC_DEEPLINKS_SERVER: http://localhost:3007
NEXT_PUBLIC_GQL_PATH: localhost:3006/gql
NEXT_PUBLIC_GQL_SSL: 0
DEEPLINKS_HASURA_PATH: localhost:8080
DEEPLINKS_HASURA_SSL: 0
MIGRATIONS_DEEPLINKS_APP_URL: http://host.docker.internal:3007
MIGRATIONS_DEEPLINKS_URL: http://host.docker.internal:3006
DOCKER: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Git Pull
run: git pull
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Configure Node caching
uses: actions/cache@v2
env:
cache-name: cache-node-modules-linux
with:
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: Install dc dependencies
run: npm clean-install
- name: Install electron dependencies
run: cd electron && npm clean-install
- name: build next
run: npm run build && npm run export && npx rimraf electron/app && npx cap copy electron
- name: Build distribution
run: cd electron && npm run electron:make
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create tar.gz file
run: |
cd electron/dist
ls
mv deep-memo-${{needs.get-app-version.outputs.app-version}}.AppImage deep-memo.AppImage
tar -czvf deep-memo.tar.gz deep-memo.AppImage
- name: And a README (to work around GitHub double-zips)
run: |
echo "More information: https://deep.foundation" > electron/dist/README.txt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Linux-deep-memo
path: |
electron/dist/deep-memo.tar.gz
electron/dist/README.txt
mac-build:
name: Mac Build
needs: [sync-electron-app-version]
env:
USE_HARD_LINKS: false
MIGRATIONS_DIR: /tmp/.migrate
ASSET_PREFIX: '.'
npm_config_yes: true
NEXT_PUBLIC_ENGINES: 1
MIGRATIONS_ID_TYPE_SQL: bigint
MIGRATIONS_ID_TYPE_GQL: bigint
MIGRATIONS_HASURA_PATH: localhost:8080
MIGRATIONS_HASURA_SSL: 0
MIGRATIONS_HASURA_SECRET: myadminsecretkey
NEXT_PUBLIC_DEEPLINKS_SERVER: http://localhost:3007
NEXT_PUBLIC_GQL_PATH: localhost:3006/gql
NEXT_PUBLIC_GQL_SSL: 0
DEEPLINKS_HASURA_PATH: localhost:8080
DEEPLINKS_HASURA_SSL: 0
MIGRATIONS_DEEPLINKS_APP_URL: http://host.docker.internal:3007
MIGRATIONS_DEEPLINKS_URL: http://host.docker.internal:3006
DOCKER: 1
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Git Pull
run: git pull
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Configure Node caching
uses: actions/cache@v2
env:
cache-name: cache-node-modules-mac
with:
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: Install dependencies
run: npm clean-install
- name: Install electron dependencies
run: cd electron && npm clean-install && ls node_modules | grep @
- name: build next
run: npm run build && npm run export && npx rimraf electron/app && npx cap copy electron
- name: Build distribution
env:
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cd electron && npm run electron:make
- name: Create zip file
run: |
cd electron/dist/mac
ditto -c -k --keepParent deep-memo.app deep-memo.app.zip
- name: And a README (to work around GitHub double-zips)
run: |
echo "More information: https://deep.foundation" > electron/dist/mac/README.txt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Mac-deep-memo
path: |
electron/dist/mac/deep-memo.app.zip
electron/dist/mac/README.txt
windows-build:
name: Windows Build
needs: [get-app-version,sync-electron-app-version]
env:
USE_HARD_LINKS: false
MIGRATIONS_DIR: .migrate
ASSET_PREFIX: '.'
npm_config_yes: true
NEXT_PUBLIC_ENGINES: 1
MIGRATIONS_ID_TYPE_SQL: bigint
MIGRATIONS_ID_TYPE_GQL: bigint
MIGRATIONS_HASURA_PATH: localhost:8080
MIGRATIONS_HASURA_SSL: 0
MIGRATIONS_HASURA_SECRET: myadminsecretkey
NEXT_PUBLIC_DEEPLINKS_SERVER: http://localhost:3007
NEXT_PUBLIC_GQL_PATH: localhost:3006/gql
NEXT_PUBLIC_GQL_SSL: 0
DEEPLINKS_HASURA_PATH: localhost:8080
DEEPLINKS_HASURA_SSL: 0
MIGRATIONS_DEEPLINKS_APP_URL: http://host.docker.internal:3007
MIGRATIONS_DEEPLINKS_URL: http://host.docker.internal:3006
DOCKER: 1
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Git Pull
run: git pull
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Configure Node caching
uses: actions/cache@v2
env:
cache-name: cache-node-modules-windows
with:
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: install node-gyp
run: npm install --global [email protected]
- name: Set Python version for node-gyp
run: echo "python=python2.7" >> ~/.npmrc
- name: Install dependencies
run: npm clean-install
- name: Install electron dependencies
run: cd electron && npm clean-install
- name: build next
run: npm run build && npm run export && npx rimraf electron/app && npx cap copy electron
- name: Build distribution
run: cd electron && npm run electron:make
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create zip file
run: |
cd electron/dist
tar.exe -a -c -f deep-memo.zip "deep-memo Setup ${{needs.get-app-version.outputs.app-version}}.exe"
- name: And a README (to work around GitHub double-zips)
run: |
echo "More information: https://deep.foundation" > electron/dist/README.txt
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Windows-deep-memo
path: |
electron/dist/deep-memo.zip
electron/dist/README.txt
android-build:
needs: [sync-electron-app-version]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm clean-install
- name: Build Android
run: npm run build-android
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Build APK
run: |
cd android
./gradlew --version
./gradlew assembleRelease --stacktrace --info
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: deep-memo-android.apk
path: android/app/build/outputs/apk/release/app-release.apk
release:
needs: [linux-build, mac-build, windows-build, get-app-version, android-build]
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{needs.get-app-version.outputs.app-version}}
release_name: Release ${{ needs.get-app-version.outputs.app-version}}
body: ${{ needs.get-app-version.outputs.app-version}}
draft: false
prerelease: false
- uses: actions/download-artifact@v3
with:
name: Linux-deep-memo
path: electron/dist
- uses: actions/download-artifact@v3
with:
name: Windows-deep-memo
path: electron/dist
- uses: actions/download-artifact@v3
with:
name: Mac-deep-memo
path: electron/dist
- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: electron/dist/deep-memo.tar.gz
asset_name: linux-deep-memo.tar.gz
asset_content_type: application/gzip
- name: upload windows artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: electron/dist/deep-memo.zip
asset_name: windows-deep-memo.zip
asset_content_type: application/zip
- name: upload windows artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: electron/dist/deep-memo.app.zip
asset_name: mac-deep-memo.zip
asset_content_type: application/zip
- name: upload android artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: android/app/build/outputs/apk/release/app-release.apk
asset_name: deep-memo-android.apk
asset_content_type: application/zip