Skip to content

Commit

Permalink
v1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
abnerlee committed Feb 16, 2020
1 parent 102d010 commit fe5837e
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 91 deletions.
66 changes: 0 additions & 66 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ typings/

# next.js build output
.next
bin/**
195 changes: 177 additions & 18 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

trigger:
- master
- develop

jobs:
- job: BaseBuild
Expand All @@ -14,31 +15,52 @@ jobs:
linux:
name: 'linux'
arch: 'x64'
imageName: 'ubuntu-16.04'
mac:
name: 'mac'
arch: 'x64'
imageName: 'macos-10.13'
extension: '.exe'
imageName: 'ubuntu-18.04'
extension: ''
cmdPrefix: ''
target: 'linux-x64'
#mac:
# name: 'mac'
# arch: 'x64'
# imageName: 'macos-10.13'
# extension: ''
# cmdPrefix: ''
# target: 'mac'
win64:
name: 'win64'
arch: 'x64'
imageName: 'vs2017-win2016'
name: 'win64'
arch: 'x64'
imageName: 'vs2017-win2016'
extension: '.exe'
cmdPrefix: 'CALL'
target: 'windows-x64'
win32:
name: 'win32'
arch: 'x86'
imageName: 'vs2017-win2016'
extension: '.exe'
cmdPrefix: 'CALL'
target: 'windows-x86'

pool:
vmImage: $(imageName)

steps:
- task: UseNode@1
inputs:
version: '12.x'
version: '12.13.0'

- script: |
yarn add nexe -D
yarn install
displayName: 'prepare'
- script: nexe index.js --output $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
$(cmdPrefix) rm -rf node_modules
$(cmdPrefix) rm -rf ~/.nexe
$(cmdPrefix) rm -rf $(Build.BinariesDirectory)/bin/$(name)
$(cmdPrefix) npm install --production
$(cmdPrefix) npm install nexe@next --global
$(cmdPrefix) nexe --clean /dev/null 2>&1
$(cmdPrefix) nexe index.js --target $(target) --resource "node_modules/**/*" --temp $(Agent.TempDirectory) --output $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
$(cmdPrefix) chmod +x $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
echo -----test result------
$(cmdPrefix) ls -lh $(Build.BinariesDirectory)/bin/$(name)
$(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
displayName: 'package'
- task: ArchiveFiles@2
Expand All @@ -48,16 +70,153 @@ jobs:
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(name).zip'
replaceExistingArchive: true

- script: $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version >> $(Build.ArtifactStagingDirectory)/version

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'picgo-cli'
publishLocation: 'Container'

- script: |
$(cmdPrefix) echo "ls System.ArtifactsDirectory"
$(cmdPrefix) ls -a $(System.ArtifactsDirectory)
$(cmdPrefix) echo "ls System.ArtifactStagingDirectory"
$(cmdPrefix) ls -a $(Build.ArtifactStagingDirectory)
$(cmdPrefix) echo "check version"
$(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
displayName: 'check result'
## Build and codesign macOS binaries
#- job: MacBuild

# variables:
# name: 'mac'
# arch: 'x64'
# imageName: 'macos-10.13'
# extension: ''
# cmdPrefix: ''
# target: 'mac'

# pool:
# vmImage: 'macos-10.13'

# steps:
# - task: UseNode@1
# inputs:
# version: '12.x'

# - task: CmdLine@2
# env:
# binFolder: $(Build.BinariesDirectory)
# inputs:
# script: |
# npm install --production
# npm install nexe@next --global
# npm link nexe@next
# npm run build-mac
# chmod +x $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
# echo -----test result------
# ls -lh $(Build.BinariesDirectory)/bin/$(name)
# $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
# displayName: 'package'

# - task: InstallAppleCertificate@2
# inputs:
# certSecureFile: 'picgo.p12'
# certPwd: '$(p12-password)'
# keychain: 'temp'

# - script: |
# codesign --force --sign Developer $(Build.BinariesDirectory)/bin/mac/picgo

# - task: ArchiveFiles@2
# inputs:
# rootFolderOrFile: '$(Build.BinariesDirectory)/bin/$(name)/'
# includeRootFolder: true
# archiveType: 'zip'
# archiveFile: '$(Build.ArtifactStagingDirectory)/$(name).zip'
# replaceExistingArchive: true

# - script: $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version >> $(Build.ArtifactStagingDirectory)/version

# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: '$(Build.ArtifactStagingDirectory)'
# ArtifactName: 'picgo-cli'
# publishLocation: 'Container'

# - script: |
# $(cmdPrefix) echo "ls System.ArtifactsDirectory"
# $(cmdPrefix) ls -a $(System.ArtifactsDirectory)
# $(cmdPrefix) echo "ls System.ArtifactStagingDirectory"
# $(cmdPrefix) ls -a $(Build.ArtifactStagingDirectory)
# $(cmdPrefix) echo "check version"
# $(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
# displayName: 'check result'


- job: Release
dependsOn: BaseBuild
dependsOn:
- BaseBuild
#- MacBuild

steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'

- script: |
ls -a $(System.ArtifactsDirectory)
echo '----'
ls -a $(System.ArtifactsDirectory)/picgo-cli
version=$(cat $(System.ArtifactsDirectory)/picgo-cli/version)
echo "version is $version"
echo "##vso[task.setvariable variable=picgo.version;]$version"
echo "picgo.version is $PICGO_VERSION"
displayName: 'check result'
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: GitHubReleaseForMasterLatest
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: 'latest'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'

- task: GitHubRelease@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: GitHubReleaseForVersion
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(picgo.version)'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'

- task: GitHubRelease@1
name: GitHubReleaseForDevelopLatest
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
action: 'edit'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
tag: 'latest-develop'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env node
const path = require('path')
const minimist = require('minimist')
const PicGo = require('picgo')

let argv = minimist(process.argv.slice(2))
let configPath = argv.c || argv.config || ''
if (configPath !== true && configPath !== '') {
configPath = path.resolve(configPath)
} else {
configPath = ''
}
const PicGo = require('picgo')
const picgo = new PicGo(configPath)
picgo.registerCommands()

Expand Down
31 changes: 31 additions & 0 deletions mac/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { compile } = require('nexe')

if(!process.env.binFolder) {
console.log(JSON.stringify(process.env));
process.exit(1);
}

compile({
build: true,
make: [ '-j4' ],
input: '../index.js',
output: (process.env.binFolder || "..") + '/bin/mac/picgo',
name: "picgo-cli",
resources: ["node_modules/**/*", "!node_modules/nexe/*"],
patches: [
(x, next) => {
x.code = () => [x.shims.join(''), x.input].join(';')
return next()
},
async (compiler, next) => {
await compiler.setFileContentsAsync(
'lib/_third_party_main.js',
compiler.code()
)
compiler.options.empty = true // <-- ADDED THIS (hack)
return next()
}
]
}).then(() => {
process.exit(0);
});
1 change: 1 addition & 0 deletions mac/sign.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codesign --force --sign Developer ../bin/mac/picgo
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{
"name": "picgo-cli",
"version": "1.3.7",
"version": "1.4.4",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"pkg-win64": "nexe index.js --output bin/win64/picgo.exe --target {platform: 'win', arch: 'x64'} --rc {CompanyName: 'PicGo'}",
"pkg-win32": "nexe index.js --output bin/win32/picgo.exe --target {platform: 'win', arch: 'ia32'} --rc {CompanyName: 'PicGo'}",
"pkg-mac": "nexe index.js --output bin/mac/picgo --target {platform: 'mac'}",
"pkg-linux": "nexe index.js --output bin/linux/picgo --target {platform: 'linux', arch: 'x64'}"
"build-mac": "node ./mac/compile.js",
"pkg": " pkg index.js --targets win --output bin/win/picgo.exe --assets node_modules/**/* --debug",
"nexe-win64": "nexe index.js --output bin/win64/picgo.exe --target {platform: 'win', arch: 'x64'} --rc {CompanyName: 'PicGo'}",
"nexe-win32": "nexe index.js --output bin/win32/picgo.exe --target {platform: 'win', arch: 'ia32'} --rc {CompanyName: 'PicGo'}",
"nexe-mac": "nexe index.js --output bin/mac/picgo --target {platform: 'mac'}",
"nexe-linux": "nexe index.js --output bin/linux/picgo --target {platform: 'linux', arch: 'x64'}"
},
"author": "",
"license": "MIT",
"dependencies": {
"minimist": "^1.2.0",
"picgo": "^1.3.7"
"picgo": "^1.4.4"
},
"pkg": {
"assets": "node_modules/**/*"
}
}

0 comments on commit fe5837e

Please sign in to comment.