Skip to content

Publish Release

Publish Release #37

Workflow file for this run

name: Publish Release
on:
workflow_dispatch:
jobs:
call-build:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
build-type: release
publish-release:
runs-on: ubuntu-latest
needs: call-build
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Download Build Artifacts
uses: actions/download-artifact@v8
with:
name: ${{ needs.call-build.outputs.artifact-name }}
- name: Extract APK Version
id: apk_version
run: |
APK_FILE=$(ls *.apk | head -n 1) # Get the first APK file
echo "Found APK: $APK_FILE"
VERSION=$(echo $APK_FILE | grep -oP '\d+\.\d+\.\d+')
echo "Extracted Version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload APKs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Release Upload URL: ${{ steps.create_release.outputs.upload_url }}"
for file in *.apk; do
echo "Uploading $file..."
upload_url="${{ steps.create_release.outputs.upload_url }}"
echo "Extracted upload URL: $upload_url"
# Clean up the URL
clean_url=$(echo "$upload_url" | sed 's/{?name,label}//')
echo "Cleaned upload URL: $clean_url"
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/vnd.android.package-archive" \
--data-binary @"$file" \
"$clean_url?name=$(basename "$file")"
done