chore: desktop workflow
This commit is contained in:
50
.github/workflows/desktop.release.test.yml
vendored
50
.github/workflows/desktop.release.test.yml
vendored
@@ -4,8 +4,35 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Release:
|
Linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: packages/desktop
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn build:web:all
|
||||||
|
|
||||||
|
- name: Compile for AppImage
|
||||||
|
run: yarn run webpack --config desktop.webpack.prod.js
|
||||||
|
- name: AppImage
|
||||||
|
run: yarn run electron-builder --linux --x64 --ia32 -c.linux.target=AppImage --publish=never
|
||||||
|
|
||||||
|
- name: Upload
|
||||||
|
uses: actions/upload-artifact@v3.0.0
|
||||||
|
with:
|
||||||
|
name: assets
|
||||||
|
path: 'packages/desktop/dist/'
|
||||||
|
|
||||||
|
Publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [Linux]
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: packages/desktop
|
working-directory: packages/desktop
|
||||||
@@ -14,20 +41,23 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: mkdir files
|
- uses: actions/download-artifact@v3
|
||||||
- run: echo Foo >> files/foo.txt
|
|
||||||
- run: echo Bar >> files/bar.txt
|
|
||||||
- name: get-npm-version
|
|
||||||
id: package-version
|
|
||||||
uses: martinbeentjes/npm-get-version-action@main
|
|
||||||
with:
|
with:
|
||||||
path: packages/desktop
|
name: assets
|
||||||
|
path: packages/desktop/dist
|
||||||
|
- run: node scripts/sums.mjs
|
||||||
|
- name: 'Get Previous tag'
|
||||||
|
id: previous_tag
|
||||||
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||||
|
with:
|
||||||
|
fallback: 1.0.0
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CI_PAT_TOKEN }}
|
token: ${{ secrets.CI_PAT_TOKEN }}
|
||||||
tag_name: "@standardnotes/desktop@${{ steps.package-version.outputs.current-version}}"
|
tag_name: ${{steps.previous_tag.outputs.tag}}
|
||||||
prerelease: true
|
prerelease: true
|
||||||
draft: true
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
packages/desktop/files/*
|
packages/desktop/dist/**
|
||||||
|
|
||||||
|
|||||||
30
.github/workflows/desktop.release.yml
vendored
30
.github/workflows/desktop.release.yml
vendored
@@ -17,6 +17,7 @@ jobs:
|
|||||||
- run: yarn build:web:all
|
- run: yarn build:web:all
|
||||||
|
|
||||||
Mac:
|
Mac:
|
||||||
|
if: true == false
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
needs: build
|
needs: build
|
||||||
defaults:
|
defaults:
|
||||||
@@ -27,6 +28,8 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn build:web:all
|
||||||
- name: Compile Mac
|
- name: Compile Mac
|
||||||
run: yarn run webpack --config desktop.webpack.prod.js
|
run: yarn run webpack --config desktop.webpack.prod.js
|
||||||
- name: MacX64
|
- name: MacX64
|
||||||
@@ -39,9 +42,10 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3.0.0
|
uses: actions/upload-artifact@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: assets
|
name: assets
|
||||||
path: 'packages/desktop/dist/'
|
path: 'packages/desktop/dist/*+(.snap|.AppImage|.yml|.yaml|.blockmap|.deb|.dmg|.zip|.exe)'
|
||||||
|
|
||||||
Linux:
|
Linux:
|
||||||
|
if: true == false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
defaults:
|
defaults:
|
||||||
@@ -52,6 +56,8 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn build:web:all
|
||||||
- name: Compile for AppImage
|
- name: Compile for AppImage
|
||||||
run: yarn run webpack --config desktop.webpack.prod.js
|
run: yarn run webpack --config desktop.webpack.prod.js
|
||||||
- name: AppImage
|
- name: AppImage
|
||||||
@@ -100,7 +106,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3.0.0
|
uses: actions/upload-artifact@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: assets
|
name: assets
|
||||||
path: 'packages/desktop/dist/'
|
path: 'packages/desktop/dist/*+(.snap|.AppImage|.yml|.yaml|.blockmap|.deb|.dmg|.zip|.exe)'
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -113,6 +119,8 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn build:web:all
|
||||||
- run: yarn run webpack --config desktop.webpack.prod.js
|
- run: yarn run webpack --config desktop.webpack.prod.js
|
||||||
- run: yarn run electron-builder --windows --x64 --ia32 --publish=never
|
- run: yarn run electron-builder --windows --x64 --ia32 --publish=never
|
||||||
|
|
||||||
@@ -120,7 +128,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3.0.0
|
uses: actions/upload-artifact@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: assets
|
name: assets
|
||||||
path: 'packages/desktop/dist/'
|
path: 'packages/desktop/dist/*+(.snap|.AppImage|.yml|.yaml|.blockmap|.deb|.dmg|.zip|.exe)'
|
||||||
|
|
||||||
Publish:
|
Publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -138,5 +146,19 @@ jobs:
|
|||||||
name: assets
|
name: assets
|
||||||
path: packages/desktop/dist
|
path: packages/desktop/dist
|
||||||
- run: node scripts/sums.mjs
|
- run: node scripts/sums.mjs
|
||||||
- run: node scripts/create-draft-release.mjs
|
- name: get-npm-version
|
||||||
|
id: package-version
|
||||||
|
uses: martinbeentjes/npm-get-version-action@main
|
||||||
|
with:
|
||||||
|
path: packages/desktop
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CI_PAT_TOKEN }}
|
||||||
|
tag_name: "@standardnotes/desktop@${{ steps.package-version.outputs.current-version}}"
|
||||||
|
prerelease: true
|
||||||
|
draft: true
|
||||||
|
name: "Desktop ${{ steps.package-version.outputs.current-version}}"
|
||||||
|
files: |
|
||||||
|
packages/desktop/dist/*
|
||||||
- run: node scripts/publishSnap.mjs
|
- run: node scripts/publishSnap.mjs
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import { Command } from './Command'
|
import { Command } from './Command.mjs'
|
||||||
import { publishSnap } from './publishSnap'
|
import { publishSnap } from './publishSnap.mjs'
|
||||||
import { runCommand } from './runCommand'
|
import { runCommand } from './runCommand.mjs'
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = path.dirname(__filename)
|
const __dirname = path.dirname(__filename)
|
||||||
@@ -159,29 +159,4 @@ const BuildCommands = {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
[Targets.Windows]: [Command('yarn run electron-builder --windows --x64 --ia32 --publish=never', DesktopDir)],
|
[Targets.Windows]: [Command('yarn run electron-builder --windows --x64 --ia32 --publish=never', DesktopDir)],
|
||||||
}
|
}
|
||||||
|
|
||||||
;(async () => {
|
|
||||||
try {
|
|
||||||
const input = process.argv[2]
|
|
||||||
let targets = input.split(',')
|
|
||||||
|
|
||||||
console.log('Input targets:', targets)
|
|
||||||
|
|
||||||
if (targets.length === 1) {
|
|
||||||
if (TargetGroups[targets[0]]) {
|
|
||||||
targets = TargetGroups[targets[0]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await buildTargets(targets)
|
|
||||||
|
|
||||||
if (input === MainstreamTargetGroup) {
|
|
||||||
await runCommand(Command('node sums.mjs', ScriptsDir))
|
|
||||||
await runCommand(Command('node create-draft-release.mjs', ScriptsDir))
|
|
||||||
await publishSnap()
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
process.exitCode = 1
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { Command } from './Command'
|
import { Command } from './Command.mjs'
|
||||||
import { runCommand } from './runCommand'
|
import { runCommand } from './runCommand.mjs'
|
||||||
import { DesktopDir } from './build'
|
import { DesktopDir } from './build.mjs'
|
||||||
|
|
||||||
export async function publishSnap() {
|
export async function publishSnap() {
|
||||||
const packageJson = await fs.promises.readFile(path.join(DesktopDir, 'package.json'))
|
try {
|
||||||
const version = JSON.parse(packageJson).version
|
const packageJson = await fs.promises.readFile(path.join(DesktopDir, 'package.json'))
|
||||||
await runCommand(Command(`snapcraft upload dist/standard-notes-${version}-linux-amd64.snap`, DesktopDir))
|
const version = JSON.parse(packageJson).version
|
||||||
|
await runCommand(Command(`snapcraft upload dist/standard-notes-${version}-linux-amd64.snap`, DesktopDir))
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error publishing snap', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user