Skip to content

Commit 103fd40

Browse files
authored
Revert "Update release workflow to check for existing releases"
1 parent 016255d commit 103fd40

File tree

1 file changed

+5
-45
lines changed

1 file changed

+5
-45
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ on:
1414
jobs:
1515
build-and-release:
1616
runs-on: ubuntu-latest
17-
# expose the release upload_url so downstream jobs can use it
18-
outputs:
19-
upload_url: ${{ steps.get_release.outputs.upload_url }}
20-
17+
2118
steps:
2219
- name: Checkout
2320
uses: actions/checkout@v4
@@ -42,24 +39,7 @@ jobs:
4239
- name: Package
4340
run: npm run package
4441

45-
- name: Check if release exists
46-
id: check_release
47-
env:
48-
TAG: ${{ github.ref_name || github.event.inputs.version }}
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
run: |
51-
echo "Checking for release $TAG"
52-
resp=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \
53-
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG")
54-
if echo "$resp" | grep -q '"message": "Not Found"'; then
55-
echo "exists=false" >> $GITHUB_OUTPUT
56-
else
57-
echo "exists=true" >> $GITHUB_OUTPUT
58-
fi
59-
6042
- name: Create Release
61-
id: create_release
62-
if: steps.check_release.outputs.exists == 'false'
6343
uses: actions/create-release@v1
6444
env:
6545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -87,32 +67,12 @@ jobs:
8767

8868
- name: Update major version tag
8969
run: |
90-
# Accept either "v1.2.3" or "1.2.3" and always push a "v<MAJOR>" tag (e.g. v1)
9170
VERSION=${{ github.ref_name || github.event.inputs.version }}
92-
STRIPPED=${VERSION#v}
93-
MAJOR_NUMBER=$(echo "$STRIPPED" | cut -d. -f1)
94-
MAJOR_TAG="v${MAJOR_NUMBER}"
71+
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
9572
git config user.name github-actions
9673
git config user.email github-actions@github.com
97-
git tag -fa "$MAJOR_TAG" -m "Update $MAJOR_TAG tag"
98-
git push origin "$MAJOR_TAG" --force
99-
100-
- name: Get release info (upload_url)
101-
id: get_release
102-
env:
103-
TAG: ${{ github.ref_name || github.event.inputs.version }}
104-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105-
run: |
106-
resp=$(curl -s -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" \
107-
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG")
108-
# extract upload_url using Python to avoid depending on jq
109-
upload_url=$(python - <<'PY'
110-
import sys, json
111-
data = json.load(sys.stdin)
112-
print(data.get("upload_url", ""))
113-
PY
114-
<<<"$resp")
115-
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT
74+
git tag -fa $MAJOR_VERSION -m "Update $MAJOR_VERSION tag"
75+
git push origin $MAJOR_VERSION --force
11676
11777
marketplace:
11878
needs: build-and-release
@@ -128,7 +88,7 @@ PY
12888
env:
12989
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13090
with:
131-
upload_url: ${{ needs.build-and-release.outputs.upload_url }}
91+
upload_url: ${{ steps.create_release.outputs.upload_url }}
13292
asset_path: ./action.yml
13393
asset_name: action.yml
13494
asset_content_type: text/yaml

0 commit comments

Comments
 (0)