Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload package to oss #1972

Merged
merged 5 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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})