Skip to content

Commit cb6b1fd

Browse files
committed
Gikk over til å bruke API'et og curl fremfor cli
1 parent 312af28 commit cb6b1fd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/buildAndPublish.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ jobs:
110110
| sed 's/\x1b\[[0-9;]*m//g' \
111111
| awk '/^release:/,0' > releases/${RELEASE_NAME}/${RELEASE_NAME}.yaml
112112
113-
114113
# Check if the file was created
115114
ls -la releases/${RELEASE_NAME}
116115
117116
# Generate changelog
118117
path=$(sfp changelog generate --branchname main --releasename ${RELEASE_NAME} --workitemfilter PTCRM-[0-9] --nopush --directory changelog | grep -oP 'Copying the repository to \K[^ ]+' | head -1)
119118
119+
echo "PATH: $path"
120+
120121
if [ -n "$path" ] && [ -d "$path/changelog" ]; then
121-
mkdir -p releases/${RELEASE_NAME}
122122
cp "$path/changelog"/* releases/${RELEASE_NAME}/
123123
else
124124
echo "Error: Path not set or directory does not exist"
@@ -137,7 +137,23 @@ jobs:
137137

138138
- name: Create Github Release
139139
run: |
140-
gh release create ${RELEASE_NAME} releases/${RELEASE_NAME}/${RELEASE_NAME}.yaml --notes-file releases/${RELEASE_NAME}/Release-Changelog.md --title ${RELEASE_NAME}
140+
UPLOAD_URL=$(curl -s -X POST \
141+
-H "Accept: application/vnd.github.v3+json" \
142+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
143+
-d '{"tag_name":"'"${RELEASE_NAME}"'","name":"'"${RELEASE_NAME}"'","body":"'"$(cat releases/${RELEASE_NAME}/Release-Changelog.md)"'"}' \
144+
https://api.github.com/repos/${{ github.repository }}/releases | jq -r '.upload_url' | sed 's/{?name,label}//')
145+
146+
curl -X POST \
147+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
148+
-H "Content-Type: application/octet-stream" \
149+
--data-binary @releases/${RELEASE_NAME}/${RELEASE_NAME}.yaml \
150+
"$UPLOAD_URL?name=${RELEASE_NAME}.yaml"
151+
152+
curl -X POST \
153+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
154+
-H "Content-Type: application/octet-stream" \
155+
--data-binary @releases/${RELEASE_NAME}/Release-Changelog.md \
156+
"$UPLOAD_URL?name=Release-Changelog.md"
141157
env:
142158
RELEASE_NAME: ${{ steps.generate_name.outputs.releaseName }}
143159

0 commit comments

Comments
 (0)