Skip to content

Commit

Permalink
upload package to oss (vesoft-inc#1972)
Browse files Browse the repository at this point in the history
* upload oss

* update

* Remove redundant

* address @yixinlu's comment

Co-authored-by: dutor <440396+dutor@users.noreply.github.com>
  • Loading branch information
laura-ding and dutor authored Apr 1, 2020
1 parent b504b0c commit 405cfb9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ jobs:
-DCMAKE_C_COMPILER=clang \
-DENABLE_ASAN=on \
-B build/
- name: Make with one thread
if: matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7'
run: |
cmake --build build/
- name: Make
if: matrix.compiler != 'gcc-9.2' || matrix.os != 'centos7'
run: |
cmake --build build/ -j $(nproc)
- name: CTest with multiple thread
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
schedule:
- cron: '0 18 * * *'
push:
# Releases are all branch based, and the branch package here is for testing.
branches:
- 'v[0-9]+.*'
paths-ignore:
Expand All @@ -30,10 +31,20 @@ jobs:
shell: bash
- name: Compute version
id: version
env:
CPACK_OUTPUT_DIR: build/cpack_output
run: |
[[ "${{ github.event_name }}" == "push" ]] && \
echo "::set-output name=version::$(cut -d/ -f3 <<< ${{ github.ref }})" || \
echo "::set-output name=version::nightly"
(echo "::set-output name=version::nightly"
cd $CPACK_OUTPUT_DIR && \
filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;)
echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename")
shell: bash
- name: upload oss
if: github.event_name != 'push'
run: |
./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} filepath=${{ steps.version.outputs.filepath }} nightly=true
shell: bash
- uses: actions/upload-artifact@v1
with:
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ jobs:
run: |
./ci/scripts/upload-github-release-asset.sh github_token=${{ secrets.GITHUB_TOKEN }} repo=${{ github.repository }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.filepath }}
./ci/scripts/upload-github-release-asset.sh github_token=${{ secrets.GITHUB_TOKEN }} repo=${{ github.repository }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.shafilepath }}
./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.filepath }}
./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.shafilepath }}
shell: bash
- name: upload release artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}-release
path: build/cpack_output

docker:
name: build docker images
Expand Down
32 changes: 32 additions & 0 deletions ci/scripts/upload-oss.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# This script upload package to oss.
#
# - OSS_ENDPOINT
# - OSS_ID
# - OSS_SECRET
# - filepath
# - tag
# - nightly
#
# Example:
#
# upload-oss.sh OSS_ENDPOINT=xxx OSS_ID=xxx OSS_SECRET=xxx tag=v0.1.0 filepath=xxx
# upload-oss.sh OSS_ENDPOINT=xxx OSS_ID=xxx OSS_SECRET=xxx filepath=xxx nightly=true

set -e

for op in $@; do
eval "$op"
done

if [[ $nightly != "" ]]; then
OSS_SUBDIR=`date +%Y%m%d`
OSS_URL="oss://nebula-graph/build-deb"/nightly/${OSS_SUBDIR}
else
OSS_SUBDIR=`echo $tag |sed 's/^v//'`
OSS_URL="oss://nebula-graph/build-deb"/${OSS_SUBDIR}
fi

echo "Uploading oss... "
ossutil64 -e ${OSS_ENDPOINT} -i ${OSS_ID} -k ${OSS_SECRET} -f cp ${filepath} ${OSS_URL}/$(basename ${filepath})

0 comments on commit 405cfb9

Please sign in to comment.