Fix release workflow error handling
Some checks failed
Go / build-and-release (push) Has been cancelled
Some checks failed
Go / build-and-release (push) Has been cancelled
- Add set -e to exit on any error - Validate GITEA_TOKEN secret is set before proceeding - Verify release binaries exist before upload attempt - Remove error-suppressing || echo patterns - Add login verification step Files modified: - .gitea/workflows/go.yml: Proper error handling for release creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -116,28 +116,49 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
set -e # Exit on any error
|
||||||
export PATH=/usr/local/go/bin:$PATH
|
export PATH=/usr/local/go/bin:$PATH
|
||||||
cd ${GITHUB_WORKSPACE}
|
cd ${GITHUB_WORKSPACE}
|
||||||
|
|
||||||
|
# Validate GITEA_TOKEN is set
|
||||||
|
if [ -z "${GITEA_TOKEN}" ]; then
|
||||||
|
echo "ERROR: GITEA_TOKEN secret is not set!"
|
||||||
|
echo "Please configure the GITEA_TOKEN secret in repository settings."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION=${GITHUB_REF_NAME}
|
VERSION=${GITHUB_REF_NAME}
|
||||||
REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f1)
|
REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f1)
|
||||||
REPO_NAME=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f2)
|
REPO_NAME=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f2)
|
||||||
|
|
||||||
echo "Creating release for ${REPO_OWNER}/${REPO_NAME} version ${VERSION}"
|
echo "Creating release for ${REPO_OWNER}/${REPO_NAME} version ${VERSION}"
|
||||||
|
|
||||||
|
# Verify release binaries exist
|
||||||
|
if [ ! -f "release-binaries/orly-${VERSION#v}-linux-amd64" ]; then
|
||||||
|
echo "ERROR: Release binary not found!"
|
||||||
|
ls -la release-binaries/ || echo "release-binaries directory does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Install tea CLI for Gitea
|
# Install tea CLI for Gitea
|
||||||
cd /tmp
|
cd /tmp
|
||||||
wget -q https://dl.gitea.com/tea/0.9.2/tea-0.9.2-linux-amd64 -O tea
|
wget -q https://dl.gitea.com/tea/0.9.2/tea-0.9.2-linux-amd64 -O tea
|
||||||
chmod +x tea
|
chmod +x tea
|
||||||
|
|
||||||
# Configure tea with the repository's Gitea instance
|
# Configure tea with the repository's Gitea instance
|
||||||
|
# Remove existing login if present, then add new one
|
||||||
|
./tea login delete runner 2>/dev/null || true
|
||||||
./tea login add \
|
./tea login add \
|
||||||
--name runner \
|
--name runner \
|
||||||
--url ${GITHUB_SERVER_URL} \
|
--url ${GITHUB_SERVER_URL} \
|
||||||
--token "${GITEA_TOKEN}" || echo "Login may already exist"
|
--token "${GITEA_TOKEN}"
|
||||||
|
|
||||||
|
# Verify login works
|
||||||
|
./tea login list
|
||||||
|
|
||||||
# Create release with assets
|
# Create release with assets
|
||||||
cd ${GITHUB_WORKSPACE}
|
cd ${GITHUB_WORKSPACE}
|
||||||
|
echo "Creating release with assets..."
|
||||||
/tmp/tea release create \
|
/tmp/tea release create \
|
||||||
--repo ${REPO_OWNER}/${REPO_NAME} \
|
--repo ${REPO_OWNER}/${REPO_NAME} \
|
||||||
--tag ${VERSION} \
|
--tag ${VERSION} \
|
||||||
@@ -145,6 +166,7 @@ jobs:
|
|||||||
--note "Automated release ${VERSION}" \
|
--note "Automated release ${VERSION}" \
|
||||||
--asset release-binaries/orly-${VERSION#v}-linux-amd64 \
|
--asset release-binaries/orly-${VERSION#v}-linux-amd64 \
|
||||||
--asset release-binaries/libsecp256k1-linux-amd64.so \
|
--asset release-binaries/libsecp256k1-linux-amd64.so \
|
||||||
--asset release-binaries/SHA256SUMS.txt \
|
--asset release-binaries/SHA256SUMS.txt
|
||||||
|| echo "Release may already exist, updating..."
|
|
||||||
|
echo "Release ${VERSION} created successfully!"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user