Public Access
feat: add Gitea workflow for automated release building and asset publishing
Release Pipeline / build-and-release (push) Failing after 5m13s
Release Pipeline / build-and-release (push) Failing after 5m13s
This commit is contained in:
1 parent
98b9d51d83
commit
13bebba16e
1 file changed
+39
-8
@@ -83,11 +83,42 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: m0606/gitea-release-action@v3
|
env:
|
||||||
with:
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
SERVER_URL: ${{ github.server_url }}
|
||||||
files: |
|
REPOSITORY: ${{ github.repository }}
|
||||||
brainwave-amd64.tar.gz
|
TAG: ${{ github.ref_name }}
|
||||||
brainwave-arm64.tar.gz
|
run: |
|
||||||
docker-compose.amd64.yml
|
# 1. Create the release
|
||||||
docker-compose.arm64.yml
|
echo "Creating release for tag: ${TAG}"
|
||||||
|
RELEASE_RESPONSE=$(curl -s -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\", \"name\":\"Release ${TAG}\", \"body\":\"Automated release for version ${TAG}\", \"draft\":false, \"prerelease\":false}" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPOSITORY}/releases")
|
||||||
|
|
||||||
|
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data.get('id', data.get('message', 'ERROR')))")
|
||||||
|
|
||||||
|
if [ "$RELEASE_ID" = "ERROR" ] || [ "$RELEASE_ID" = "release already exists for this tag" ]; then
|
||||||
|
echo "Release might already exist, attempting to find it..."
|
||||||
|
RELEASE_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPOSITORY}/releases" \
|
||||||
|
| python3 -c "import sys, json; releases=json.load(sys.stdin); print(next((r['id'] for r in releases if r['tag_name'] == '${TAG}'), 'ERROR'))")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$RELEASE_ID" = "ERROR" ]; then
|
||||||
|
echo "Failed to create or find release: $RELEASE_RESPONSE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Uploading assets to release ID: ${RELEASE_ID}"
|
||||||
|
for FILE in brainwave-amd64.tar.gz brainwave-arm64.tar.gz docker-compose.amd64.yml docker-compose.arm64.yml; do
|
||||||
|
echo "Uploading ${FILE}..."
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${FILE}" \
|
||||||
|
"${SERVER_URL}/api/v1/repos/${REPOSITORY}/releases/${RELEASE_ID}/assets?name=${FILE}" \
|
||||||
|
| grep -q "id" || { echo "Failed to upload ${FILE}"; exit 1; }
|
||||||
|
done
|
||||||
|
echo "Release completed successfully!"
|
||||||
Reference in new issue
Block a user