fix: gitea release step
This commit is contained in:
parent
cb4fe76cd7
commit
d80c9e625d
@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.get_version.outputs.version }}
|
||||
released: ${{ steps.check_release.outputs.released }}
|
||||
released: ${{ steps.check_release.outputs.released || steps.gradle_version.outputs.released }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@ -158,6 +158,7 @@ jobs:
|
||||
if git tag -l "$VERSION_NAME" | grep -q "$VERSION_NAME"; then
|
||||
echo "✅ Tag $VERSION_NAME already exists, skipping tag creation"
|
||||
echo "tag_exists=true" >> $GITHUB_OUTPUT
|
||||
echo "released=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "🏷️ Creating tag $VERSION_NAME for version in build.gradle.kts"
|
||||
|
||||
@ -171,6 +172,7 @@ jobs:
|
||||
|
||||
echo "✅ Created and pushed tag $VERSION_NAME"
|
||||
echo "tag_exists=false" >> $GITHUB_OUTPUT
|
||||
echo "released=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Export version for later steps
|
||||
@ -239,15 +241,24 @@ jobs:
|
||||
# If we created a tag from build.gradle.kts, use that version
|
||||
if [ "${{ steps.gradle_version.outputs.tag_exists }}" == "false" ]; then
|
||||
VERSION="${{ steps.gradle_version.outputs.version }}"
|
||||
echo "Tag was created from build.gradle.kts with version: $VERSION"
|
||||
# Otherwise try to get version from semantic-release if it ran
|
||||
elif [ "${{ steps.check_release.outputs.released == 'true' }}" == "true" ]; then
|
||||
elif [ "${{ steps.check_release.outputs.released }}" == "true" ]; then
|
||||
VERSION=$(git describe --tags --abbrev=0)
|
||||
echo "Version from semantic-release: $VERSION"
|
||||
# Fall back to most recent tag
|
||||
else
|
||||
VERSION=$(git describe --tags --abbrev=0 || echo "dev")
|
||||
echo "Using existing tag version: $VERSION"
|
||||
fi
|
||||
|
||||
echo "Extracted version: $VERSION"
|
||||
# Make sure we have a version to use
|
||||
if [ -z "$VERSION" ] || [ "$VERSION" == "dev" ]; then
|
||||
echo "⚠️ No valid version found, checking build.gradle.kts directly"
|
||||
VERSION=$(grep -oP 'versionName\s*=\s*"\K[^"]+' app/build.gradle.kts || echo "dev")
|
||||
fi
|
||||
|
||||
echo "Final extracted version: $VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Rename APK with version
|
||||
@ -292,6 +303,11 @@ jobs:
|
||||
if: success() && needs.build_and_release.outputs.released == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install GitHub CLI
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@ -306,8 +322,17 @@ jobs:
|
||||
- name: Download APK artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
# Use the versioned artifact name
|
||||
name: apk-${{ needs.build_and_release.outputs.version }}
|
||||
# Use the versioned artifact name or fallback to the SHA
|
||||
name: apk-${{ needs.build_and_release.outputs.version || github.sha }}
|
||||
path: ./release
|
||||
continue-on-error: true
|
||||
|
||||
- name: Try alternative artifact name if first attempt failed
|
||||
if: ${{ failure() }}
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
# Try with just the SHA if version-based name failed
|
||||
name: apk-${{ github.sha }}
|
||||
path: ./release
|
||||
|
||||
- name: List downloaded files
|
||||
|
Loading…
x
Reference in New Issue
Block a user