File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Upload artifact
2+ on :
3+ release :
4+ types : [published]
5+ jobs :
6+ publish :
7+ name : Publish
8+ runs-on : macOS-latest
9+ steps :
10+ - name : ⬇️ Checkout
11+ uses : actions/checkout@master
12+ - name : 📦 Build archive
13+ run : |
14+ REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
15+ zip -r $REPOSITORY_NAME.zip . -x ".*" -x "__MACOSX"
16+ - name : ⬆️ Upload to Release
17+ run : |
18+ REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
19+ ARTIFACT=./$REPOSITORY_NAME.zip
20+ AUTH_HEADER="Authorization: token $GITHUB_TOKEN"
21+ CONTENT_LENGTH_HEADER="Content-Length: $(stat -f%z "$ARTIFACT")"
22+ CONTENT_TYPE_HEADER="Content-Type: application/zip"
23+ RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
24+ FILENAME=$(basename $ARTIFACT)
25+ UPLOAD_URL="https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$FILENAME"
26+ echo "$UPLOAD_URL"
27+ curl -sSL -XPOST \
28+ -H "$AUTH_HEADER" -H "$CONTENT_LENGTH_HEADER" -H "$CONTENT_TYPE_HEADER" \
29+ --upload-file "$ARTIFACT" "$UPLOAD_URL"
30+ env :
31+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments