Skip to content

Commit

Permalink
fix: Upload assets from github action (#245)
Browse files Browse the repository at this point in the history
<!-- Thank you for your contribution. Before you submit the pull
request:
1. Follow contributing guidelines, templates, the recommended Git
workflow, and any related documentation.
2. Read and submit the required Contributor Licence Agreements
(https://github.com/kyma-project/community/blob/main/CONTRIBUTING.md#agreements-and-licenses).
3. Test your changes and attach their results to the pull request.
4. Update the relevant documentation.

If the pull request requires a decision, follow the [decision-making
process](https://github.com/kyma-project/community/blob/main/governance.md)
and replace the PR template with the [decision record
template](https://github.com/kyma-project/community/blob/main/.github/ISSUE_TEMPLATE/decision-record.md).
-->

**Description**

related kyma-project/lifecycle-manager#1811
**Related issue(s)**
<!-- If you refer to a particular issue, provide its number. For
example, `Resolves #123`, `Fixes #43`, or `See also #33`. -->
  • Loading branch information
ruanxin authored Sep 2, 2024
1 parent 7444469 commit 37464d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
run: |
git tag ${{ github.event.inputs.name }}
git push origin ${{ github.event.inputs.name }}
- name: Create release assets
id: create-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_BASE_REF: ${{ github.event.inputs.name }}
run: ./scripts/release/upload_assets.sh
outputs:
release_id: ${{ steps.draft-release.outputs.release_id }}

Expand Down
10 changes: 2 additions & 8 deletions scripts/release/upload_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ uploadFile() {
echo "Uploading ${filePath} as ${ghAsset}"
response=$(curl -s -o output.txt -w "%{http_code}" \
--request POST --data-binary @"$filePath" \
-H "Authorization: token $BOT_GITHUB_TOKEN" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: text/yaml" \
"$ghAsset")
if [[ "$response" != "201" ]]; then
Expand All @@ -31,14 +31,10 @@ MODULE_VERSION=${PULL_BASE_REF} make build-manifests
echo "Generated template-operator.yaml:"
cat template-operator.yaml

MODULE_VERSION=${PULL_BASE_REF} make build-module
echo "Generated module-template.yaml:"
cat module-template.yaml

echo "Fetching releases"
CURL_RESPONSE=$(curl -w "%{http_code}" -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $BOT_GITHUB_TOKEN"\
-H "Authorization: Bearer $GITHUB_TOKEN"\
https://api.github.com/repos/kyma-project/template-operator/releases)
JSON_RESPONSE=$(sed '$ d' <<< "${CURL_RESPONSE}")
HTTP_CODE=$(tail -n1 <<< "${CURL_RESPONSE}")
Expand All @@ -62,6 +58,4 @@ UPLOAD_URL="https://uploads.github.com/repos/kyma-project/template-operator/rele

echo "$UPLOAD_URL"
uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml"
uploadFile "module-template.yaml" "${UPLOAD_URL}?name=module-template.yaml"
uploadFile "config/samples/default-sample-cr.yaml" "${UPLOAD_URL}?name=default-sample-cr.yaml"
uploadFile "module-config.yaml" "${UPLOAD_URL}?name=module-config.yaml"

0 comments on commit 37464d8

Please sign in to comment.