Skip to content

Commit

Permalink
More script fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyicker committed Apr 13, 2024
1 parent 2f13ce9 commit 4506f66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ on:
push:
tags:
- '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
packages: write
jobs:
create-github-release:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- run: .scripts/github/release.sh > upload_url
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
with:
name: upload_url
path: upload_url
jvm-maven-github:
runs-on: macos-14-xlarge
needs: [ create-github-release ]
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/runGradleTask
with:
preTaskString: -Pversion=$GITHUB_REF_NAME
task: library:publishKotlinMultiplatformPublicationToGithubPackagesRepository
- uses: actions/[email protected]
with:
name: upload_url
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
attach-xcframework-to-github-release:
runs-on: macos-14-xlarge
needs: [ create-github-release ]
Expand All @@ -38,12 +40,12 @@ jobs:
- uses: actions/[email protected]
with:
name: upload_url
- run: UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${GITHUB_REF_NAME}.xcframework.zip/")
- run: echo UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${GITHUB_REF_NAME}.xcframework.zip/") >> $GITHUB_ENV
- run: |
curl -s \
-u ${GITHUB_ACTOR}:${GITHUB_TOKEN} \
--header "Accept: application/vnd.github.v3+json" \
--header "Content-Type: application/zip" \
--data-binary "@Library.xcframework.zip" \
--request POST \
$UPLOAD_URL
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--data-binary "@Library.xcframework.zip" \
$UPLOAD_URL
13 changes: 8 additions & 5 deletions .scripts/github/release.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash
set -e

BODY="{
\"tag_name\": \"${GITHUB_REF_NAME}\",
\"target_commitish\": \"${GITHUB_SHA}\",
\"name\": \"${GITHUB_REF_NAME}\",
\"body\": \"$(cat ../../changelog/"$GITHUB_REF_NAME")\"
\"body\": \"$(cat "$GITHUB_WORKSPACE"/changelog/"$GITHUB_REF_NAME")\"
}"

RESPONSE_BODY=$(curl -s \
-u "${GITHUB_ACTOR}":"${GITHUB_TOKEN}" \
--header "Accept: application/vnd.github.v3+json" \
--header "Content-Type: application/json; charset=utf-8" \
RESPONSE_BODY=$(curl -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--request POST \
--data "${BODY}" \
https://api.github.com/repos/"${GITHUB_REPOSITORY}"/releases)
Expand Down

0 comments on commit 4506f66

Please sign in to comment.