Skip to content

Commit

Permalink
➕ Add CI release workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
e-marchand committed Nov 26, 2019
1 parent 4d7bc0d commit 37b96d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Upload artifact
on:
release:
types: [published]
jobs:
publish:
name: Publish
runs-on: macOS-latest
steps:
- name: ⬇️ Checkout
uses: actions/checkout@master
- name: 📦 Build archive
run: |
REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
zip -r $REPOSITORY_NAME.zip . -x ".*" -x "__MACOSX"
- name: ⬆️ Upload to Release
run: |
REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
ARTIFACT=./$REPOSITORY_NAME.zip
AUTH_HEADER="Authorization: token $GITHUB_TOKEN"
CONTENT_LENGTH_HEADER="Content-Length: $(stat -f%z "$ARTIFACT")"
CONTENT_TYPE_HEADER="Content-Type: application/zip"
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
FILENAME=$(basename $ARTIFACT)
UPLOAD_URL="https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$FILENAME"
echo "$UPLOAD_URL"
curl -sSL -XPOST \
-H "$AUTH_HEADER" -H "$CONTENT_LENGTH_HEADER" -H "$CONTENT_TYPE_HEADER" \
--upload-file "$ARTIFACT" "$UPLOAD_URL"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 37b96d0

Please sign in to comment.