Skip to content

Commit f44e465

Browse files
committed
Is this proper?
1 parent 90065c0 commit f44e465

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,24 @@ jobs:
3030
else
3131
echo "release_exists=false" >> $GITHUB_OUTPUT
3232
fi
33+
- name: Delete Existing Release
34+
if: steps.check_release.outputs.release_exists == 'true'
35+
run: |
36+
curl -L \
37+
-X DELETE \
38+
-H "Accept: application/vnd.github+json" \
39+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
40+
-H "X-GitHub-Api-Version: 2022-11-28" \
41+
https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.check_release.outputs.release_id }}
42+
43+
curl \
44+
-X DELETE \
45+
-H "Accept: application/vnd.github+json" \
46+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
47+
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ steps.date.outputs.date }}
3348
- name: Create Release
3449
id: create_release
3550
uses: actions/create-release@v1
36-
if: steps.check_release.outputs.release_exists == 'false'
3751
env:
3852
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3953
with:
@@ -56,7 +70,6 @@ jobs:
5670
run: |
5771
make
5872
- name: 🌥️⬆️ Upload Assets - New Release
59-
if: needs.create_release.outputs.release_exists == 'false'
6073
uses: actions/upload-release-asset@v1
6174
env:
6275
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -65,29 +78,4 @@ jobs:
6578
asset_name: Constitution.pdf
6679
asset_path: ./constitution.pdf
6780
asset_content_type: application/pdf
68-
- name: Upload Assets - Existing Release - Delete Existing Asset
69-
if: needs.create_release.outputs.release_exists == 'true'
70-
run: |
71-
asset_id=$(curl -L \
72-
-H "Accept: application/vnd.github+json" \
73-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
74-
-H "X-GitHub-Api-Version: 2022-11-28" \
75-
https://api.github.com/repos/${{ github.repository }}/releases/${{ needs.create_release.outputs.release_id }}/assets | jq '.[] | select(.name == "Constitution.pdf") | .id')
76-
77-
curl -L \
78-
-X DELETE \
79-
-H "Accept: application/vnd.github+json" \
80-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
81-
-H "X-GitHub-Api-Version: 2022-11-28" \
82-
https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id
83-
- name: 🌥️⬆️ Upload Assets - Existing Release
84-
if: needs.create_release.outputs.release_exists == 'true'
85-
uses: actions/upload-release-asset@v1
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
with:
89-
upload_url: "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.create_release.outputs.release_id }}/assets?name=Constitution.pdf"
90-
asset_name: Constitution.pdf
91-
asset_path: ./constitution.pdf
92-
asset_content_type: application/pdf
9381

0 commit comments

Comments
 (0)