-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e516ea9
commit 36e6e36
Showing
3 changed files
with
84 additions
and
3 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
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,58 @@ | ||
name: Build & Release GitBook | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'The release version of the gitbook, such as v1.1.1' | ||
required: true | ||
default: 'v1.1.0' | ||
|
||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
|
||
jobs: | ||
get-upload-url: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: sudo sh ./getuploadurl.sh ${{ github.event.inputs.version }} ${{ secrets.GITHUB_TOKEN }} | ||
id: upload-url | ||
outputs: | ||
upload-url: ${{ steps.upload-url.outputs.upload-url }} | ||
|
||
build: | ||
needs: get-upload-url | ||
name: Build & Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Node.js 10.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "10.22.0" | ||
- name: Setup gitbook | ||
run: | | ||
npm install -g npm | ||
npm install -g gitbook-cli | ||
- name: Checkout main source | ||
uses: actions/checkout@v2 | ||
- name: Build the book | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
mkdir node_modules && cd node_modules && npm install gitbook-plugin-sitemap-general && cd .. | ||
gitbook install | ||
cp -r misc/gitbook-plugin-hints/* node_modules/gitbook-plugin-hints/ | ||
cp misc/tbfed-pagefooter_index.js node_modules/gitbook-plugin-tbfed-pagefooter/index.js | ||
gitbook build | ||
- name: package the book | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
mv _book monolith-to-microservices && tar czvf "${{ github.event.inputs.version }}.tar.gz" monolith-to-microservices/* | ||
ls . | ||
- uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.get-upload-url.outputs.upload-url }} | ||
asset_path: ${{ github.event.inputs.version }}.tar.gz | ||
asset_name: ${{ github.event.inputs.version }}.tar.gz | ||
asset_content_type: 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,23 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -ne 2 ] | ||
then | ||
echo "::error the parameters error, please check!!!" | ||
exit 1 | ||
fi | ||
|
||
URL_PREFIX="https://api.github.com/repos/wangwei1237/monolith-to-microservices/releases" | ||
|
||
version=$1 | ||
token=$2 | ||
|
||
get_release_url="${URL_PREFIX}/tags/${version}" | ||
upload_url=$(curl -H "Accept: application/vnd.github.v3+json" "${get_release_url}" | grep 'upload_url' | cut -d'"' -f4) | ||
|
||
create_release_url="${URL_PREFIX}" | ||
if [ "$upload_url" = "" ] | ||
then | ||
upload_url=$(curl -X POST -H "Accept: application/vnd.github.v3+json" "${create_release_url}?access_token=${token}" -d "{\"tag_name\":\"${tag}\", \"name\":\"libvmaf Build for ${version}\"}" | grep 'upload_url' | cut -d'"' -f4) | ||
fi | ||
|
||
echo "::set-output name=upload-url::$upload_url" |