Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Fix action can't run on centos6 #874

Merged
merged 8 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/actions/upload-assets-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Upload file to release assets

**Required** tag name of release branch. Default `${{ github.ref }}`.

### `file-path`
### `asset-path`

**Required** file path to be uploaded. Default `''`.

Expand All @@ -17,6 +17,6 @@ Upload file to release assets
```yaml
uses: ./.github/actions/upload-assets-action
with:
file-path: ${{ steps.pkg.outputs.filepath }}
asset-path: build/cpack_output
tag: ${{ steps.tag.outputs.tag }}
```
31 changes: 22 additions & 9 deletions .github/actions/upload-assets-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
description: 'git tag'
required: true
default: ${{ github.ref }}
file-path:
asset-path:
description: 'file path to be uploaded'
required: true
default: ''
Expand All @@ -15,13 +15,26 @@ runs:
- run: |
GH_RELEASE="https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ inputs.tag }}"
upload_url=$(curl -s --request GET --url $GH_RELEASE | grep -oP '(?<="upload_url": ")[^"]*' | cut -d'{' -f1)
content_type=$(file -b --mime-type ${{ inputs.file-path }})
filename=$(basename "${{ inputs.file-path }}")
j=0
if [ -d ${{ inputs.asset-path }} ]; then
for filename in `ls ${{ inputs.asset-path }}`;
do
folder_list[j]=${{ inputs.asset-path }}/$filename
j=`expr $j + 1`
done
else
folder_list[0]=${{ inputs.asset-path }}
fi
echo "Uploading asset... "
curl --silent \
--request POST \
--url "$upload_url?name=$filename" \
--header "authorization: Bearer ${{ github.token }}" \
--header "content-type: $content_type" \
--data-binary @"${{ inputs.file-path }}"
for filepath in ${folder_list[@]};
do
filename=$(basename "${filepath}")
content_type=$(file -b --mime-type ${filepath})
curl --silent \
--request POST \
--url "$upload_url?name=$filename" \
--header "authorization: Bearer ${{ github.token }}" \
--header "content-type: $content_type" \
--data-binary @"${filepath}"
done
shell: bash
42 changes: 42 additions & 0 deletions .github/actions/upload-to-oss-action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Upload file to oss

Upload file to oss

## Inputs

### `key-id`

**Required** access key ID of oss. Default `''`.

### `key-secret`

**Required** access key secret of oss. Default `''`.

### `endpoint`

**Required** endpoint of oss. Default `''`.

### `bucket`

**Required** bucket of oss. Default `''`.

### `asset-path`

**Required** file path to be uploaded. Default `''`.

### `target-path`

**Required** path where the oss object is stored. Default `''`.

## Example usage

```yaml
uses: ./.github/actions/upload-to-oss-action
with:
key-id: ${{ secrets.OSS_ID }}
key-secret: ${{ secrets.OSS_SECRET }}
endpoint: ${{ secrets.OSS_ENDPOINT }}
bucket: nebula-graph
asset-path: build/cpack_output
target-path: package/v2-nightly/${{ steps.vars.outputs.subdir }}
```
50 changes: 50 additions & 0 deletions .github/actions/upload-to-oss-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Upload to oss'
description: 'Upload files to oss'
inputs:
key-id:
description: 'access key ID'
required: true
default: ''
key-secret:
description: 'access key secret'
required: true
default: ''
endpoint:
description: 'endpooint'
required: true
default: ''
bucket:
description: 'bucket'
required: true
default: ''
asset-path:
description: 'file path to be uploaded'
required: true
default: ''
target-path:
description: 'file path stored on the OSS'
required: true
default: ''
runs:
using: "composite"
steps:
- run: |
j=0
if [ -d ${{ inputs.asset-path }} ]; then
for filename in `ls ${{ inputs.asset-path }}`;
do
folder_list[j]=${{ inputs.asset-path }}/$filename
j=`expr $j + 1`
done
else
folder_list[0]=${{ inputs.asset-path }}
fi
echo "Uploading to oss... "
for filepath in ${folder_list[@]};
do
ossutil64 -e ${{ inputs.endpoint}} \
jievince marked this conversation as resolved.
Show resolved Hide resolved
-i ${{ inputs.key-id }} \
-k ${{ inputs.key-secret }} \
-f cp $filepath oss://${{ inputs.bucket }}/${{ inputs.target-path }}/$(basename ${filepath})
done
shell: bash
11 changes: 4 additions & 7 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- ubuntu1604
- ubuntu1804
- ubuntu2004
# - centos6
- centos6
- centos7
- centos8
container:
Expand All @@ -35,19 +35,16 @@ jobs:
filename=$(find build/cpack_output -type f \( -iname \*.deb -o -iname \*.rpm \))
sha256sum $filename > $filename.$SHA_EXT
subdir=$(date -u +%Y.%m.%d)
echo "::set-output name=filepath::$filename"
echo "::set-output name=shafilepath::$filename.$SHA_EXT"
echo "::set-output name=subdir::$subdir"
jievince marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}-v2-nightly
path: build/cpack_output
- name: upload package to oss
uses: tvrcgo/[email protected]
- uses: ./.github/actions/upload-to-oss-action
with:
key-id: ${{ secrets.OSS_ID }}
key-secret: ${{ secrets.OSS_SECRET }}
endpoint: ${{ secrets.OSS_ENDPOINT }}
bucket: nebula-graph
asset-path: build/cpack_output
target-path: /package/v2-nightly/${{ steps.vars.outputs.subdir }}
target-path: package/v2-nightly/${{ steps.vars.outputs.subdir }}
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,19 @@ jobs:
filename=$(find build/cpack_output -type f \( -iname \*.deb -o -iname \*.rpm \))
sha256sum $filename > $filename.$SHA_EXT
subdir=$(echo $tag |sed 's/^v//')
echo "::set-output name=filepath::$filename"
echo "::set-output name=shafilepath::$filename.$SHA_EXT"
echo "::set-output name=subdir::$subdir"
jievince marked this conversation as resolved.
Show resolved Hide resolved
- uses: ./.github/actions/upload-assets-action
with:
file-path: ${{ steps.vars.outputs.filepath }}
asset-path: build/cpack_output
tag: ${{ steps.tag.outputs.tag }}
- name: upload package to oss
uses: tvrcgo/[email protected]
- uses: ./.github/actions/upload-to-oss-action
with:
key-id: ${{ secrets.OSS_ID }}
key-secret: ${{ secrets.OSS_SECRET }}
endpoint: ${{ secrets.OSS_ENDPOINT }}
bucket: nebula-graph
asset-path: build/cpack_output
target-path: /package/${{ steps.vars.outputs.subdir }}
target-path: package/${{ steps.vars.outputs.subdir }}

docker_build_graph:
name: docker-graph
Expand Down