-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MajsoulPaipuCrawler' into doc
- Loading branch information
Showing
10 changed files
with
358 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require('fs'); | ||
|
||
console.log(process.argv); | ||
|
||
let github_event = JSON.parse(fs.readFileSync(process.argv[3]).toString()); | ||
|
||
let token = process.argv[2]; | ||
let id = github_event.release.id; | ||
let repo = process.argv[4]; | ||
let filename = process.argv[5]; | ||
let filetype = process.argv[6] || 'application/octet-stream'; | ||
let length = fs.statSync(filename).size; | ||
|
||
let cmd = 'curl -v -X POST' | ||
+ ' -H "Authorization: token ' + token + '"' | ||
+ ' -H "Content-Length: ' + length + '"' | ||
+ ' -H "Content-Type: ' + filetype + '"' | ||
+ ' --upload-file ' + filename | ||
+ ' https://uploads.github.com/repos/' + repo + '/releases/' + id + '/assets?name=' + filename; | ||
|
||
console.log(cmd.replace(token, 'b2c736a8de4c71f45429acc0775671d9b5e452c3')); | ||
|
||
var exec = require('child_process').exec; | ||
|
||
exec(cmd, function(error, stdout, stderr) { | ||
if(error){ | ||
console.error(error); | ||
} | ||
else{ | ||
console.log("curl success, stdout:\n" + stdout); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const fs = require('fs'); | ||
|
||
let alltext = fs.readFileSync(__dirname + '/doc/release-notes.txt').toString(); | ||
let packagefile = JSON.parse(fs.readFileSync(__dirname + '/package.json').toString()); | ||
alltext = alltext.replace(/\r/g, ''); | ||
let text = ''; | ||
let package_version = 'v' + packagefile.version; | ||
let version = ''; | ||
for (let i = 0; i < alltext.length; i ++ ){ | ||
if (alltext[i] == '\n' && version.length == 0) | ||
version = 'v' + alltext.slice(0, i); | ||
if (alltext[i] == '\n' && alltext[i + 1] == '\n'){ | ||
text = alltext.slice(0, i); | ||
break; | ||
} | ||
} | ||
|
||
if (package_version != version){ | ||
console.error('version differ!', package_version, version); | ||
process.exit(1); | ||
} | ||
|
||
version = package_version; | ||
|
||
let result = { | ||
"tag_name": version, | ||
"target_commitish": "master", | ||
"name": version, | ||
"body": text, | ||
"draft": false, | ||
"prerelease": false | ||
}; | ||
|
||
result = JSON.stringify(result); | ||
|
||
let token = process.argv[2]; | ||
let repo = process.argv[3]; | ||
|
||
let cmd = 'curl -X POST -H "Authorization: token ' + token + '"' | ||
+ ' --data ' + "'" + result + "'" | ||
+ ' https://api.github.com/repos/' + repo + '/releases'; | ||
|
||
console.log(cmd.replace(token, 'b2c736a8de4c71f45429acc0775671d9b5e452c3')); | ||
|
||
var exec = require('child_process').exec; | ||
|
||
exec(cmd, function(error, stdout, stderr) { | ||
if(error){ | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
else{ | ||
console.log("curl success, stdout:\n" + stdout); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: master CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm | ||
run: | | ||
npm ci | ||
npm run-script package-win | ||
- name: cmake | ||
run: | | ||
git submodule update --init --recursive | ||
mkdir bin | ||
mkdir bin/release | ||
cd bin/release | ||
cmake ../.. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" | ||
make -j | ||
- name: collect | ||
run: | | ||
cp -r dist/MajsoulPaipuCrawler-win32-x64 result | ||
cp bin/release/PaipuAnalyzer.exe result/ | ||
mkdir result/data | ||
cp config.json result/ | ||
cp PAADData.json result/ | ||
cp doc/README.txt result/ | ||
cp doc/release-notes.txt result/ | ||
cp -r i18n/ result/ | ||
mv result MajsoulPaipuAnalyzer-win-x64 | ||
- name: archive | ||
run: 7z a MajsoulPaipuAnalyzer-win-x64.7z MajsoulPaipuAnalyzer-win-x64 -m0=LZMA2 -mmt | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: MajsoulPaipuAnalyzer-win-x64.7z | ||
path: MajsoulPaipuAnalyzer-win-x64.7z | ||
# - name: check GITHUB_EVENT_PATH | ||
# run: echo $env:GITHUB_EVENT_PATH; echo `cat $env:GITHUB_EVENT_PATH` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Linux CI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
if: "!github.event.release.prerelease" | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm | ||
run: | | ||
npm ci | ||
npm run-script package-linux | ||
- name: cmake | ||
run: | | ||
git submodule update --init --recursive | ||
mkdir bin | ||
mkdir bin/release | ||
cd bin/release | ||
cmake ../.. -DCMAKE_BUILD_TYPE=Release | ||
make -j | ||
- name: collect | ||
run: | | ||
cp -r dist/MajsoulPaipuCrawler-linux-x64 result | ||
cp bin/release/PaipuAnalyzer result/ | ||
mkdir result/data | ||
cp config.json result/ | ||
cp PAADData.json result/ | ||
cp doc/README.txt result/ | ||
cp doc/release-notes.txt result/ | ||
cp -r i18n/ result/ | ||
mv result MajsoulPaipuAnalyzer-linux-x64 | ||
- name: archive | ||
run: 7z a MajsoulPaipuAnalyzer-linux-x64.7z MajsoulPaipuAnalyzer-linux-x64 -m0=LZMA2 -mmt | ||
# - uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: MajsoulPaipuAnalyzer-linux-x64.7z | ||
# path: MajsoulPaipuAnalyzer-linux-x64.7z | ||
# - name: fake artifact | ||
# run: mv result.html MajsoulPaipuAnalyzer-linux-x64.7z | ||
- name: Upload to release | ||
run: | | ||
cp .github/asset.js . | ||
node asset.js ${{ secrets.ACCESS_TOKEN }} $GITHUB_EVENT_PATH $GITHUB_REPOSITORY MajsoulPaipuAnalyzer-linux-x64.7z application/octet_stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: MacOS CI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
if: "!github.event.release.prerelease" | ||
runs-on: macOS-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm | ||
run: | | ||
npm ci | ||
npm run-script package-darwin | ||
- name: cmake | ||
run: | | ||
git submodule update --init --recursive | ||
mkdir bin | ||
mkdir bin/release | ||
cd bin/release | ||
cmake ../.. -DCMAKE_BUILD_TYPE=Release | ||
make -j | ||
- name: collect | ||
run: | | ||
cp -r dist/MajsoulPaipuCrawler-darwin-x64 result | ||
cp bin/release/PaipuAnalyzer result/ | ||
mkdir result/data | ||
cp config.json result/ | ||
cp PAADData.json result/ | ||
cp doc/README.txt result/ | ||
cp doc/release-notes.txt result/ | ||
cp -r i18n/ result/ | ||
mv result MajsoulPaipuAnalyzer-macos-x64 | ||
- name: archive | ||
run: | | ||
brew install p7zip | ||
7z a MajsoulPaipuAnalyzer-macos-x64.7z MajsoulPaipuAnalyzer-macos-x64 -m0=LZMA2 -mmt | ||
- name: Upload to release | ||
run: | | ||
cp .github/asset.js . | ||
node asset.js ${{ secrets.ACCESS_TOKEN }} $GITHUB_EVENT_PATH $GITHUB_REPOSITORY MajsoulPaipuAnalyzer-macos-x64.7z application/octet_stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: New Tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
# - name: check GITHUB_EVENT_PATH | ||
# run: echo $GITHUB_EVENT_PATH; echo `cat $GITHUB_EVENT_PATH` | ||
- name: update tag | ||
run: | | ||
cp .github/tag.js . | ||
node tag.js ${{ secrets.ACCESS_TOKEN }} $GITHUB_REPOSITORY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Windows CI | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
if: "!github.event.release.prerelease" | ||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm | ||
run: | | ||
npm ci | ||
npm run-script package-win | ||
- name: cmake | ||
run: | | ||
git submodule update --init --recursive | ||
mkdir bin | ||
mkdir bin/release | ||
cd bin/release | ||
cmake ../.. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" | ||
make -j | ||
- name: collect | ||
run: | | ||
cp -r dist/MajsoulPaipuCrawler-win32-x64 result | ||
cp bin/release/PaipuAnalyzer.exe result/ | ||
mkdir result/data | ||
cp config.json result/ | ||
cp PAADData.json result/ | ||
cp doc/README.txt result/ | ||
cp doc/release-notes.txt result/ | ||
cp -r i18n/ result/ | ||
mv result MajsoulPaipuAnalyzer-win-x64 | ||
- name: archive | ||
run: 7z a MajsoulPaipuAnalyzer-win-x64.7z MajsoulPaipuAnalyzer-win-x64 -m0=LZMA2 -mmt | ||
- name: Upload to release | ||
run: | | ||
echo $GITHUB_EVENT_PATH $GITHUB_REPOSITORY | ||
echo $env:GITHUB_EVENT_PATH $env:GITHUB_REPOSITORY | ||
cp .github/asset.js . | ||
node asset.js ${{ secrets.ACCESS_TOKEN }} $env:GITHUB_EVENT_PATH $env:GITHUB_REPOSITORY MajsoulPaipuAnalyzer-win-x64.7z application/octet_stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.