name: Create Release on: workflow_dispatch: inputs: version: description: 'Version for this release (e.g. 1.0.0)' required: true default: '' prerelease: description: 'Is this a pre-release?' required: true default: 'false' type: boolean description: description: 'Release description' required: false default: 'New release' jobs: create-release: runs-on: macos steps: - name: Checkout repository uses: actions/checkout@v3 with: lfs: true fetch-depth: 0 - name: Download build artifacts run: | mkdir -p Builds echo "Downloading build artifacts..." # Try direct download from artifact URL using API TOKEN="${{ secrets.GITEATOKEN }}" REPO="goran/lyra_game_ue" ARTIFACT_NAME="macos-build" echo "Directly downloading latest artifacts..." curl -s -H "Authorization: token $TOKEN" \ -L "https://luckyrobots.com/api/v1/repos/$REPO/actions/artifacts/$ARTIFACT_NAME/zip" \ -o "Builds/macos-build.zip" || echo "Failed to download using API" # Check if we got anything if [ -f "Builds/macos-build.zip" ] && [ $(stat -f%z "Builds/macos-build.zip") -gt 100 ]; then echo "Successfully downloaded artifact via API" mkdir -p Builds/extracted unzip -o "Builds/macos-build.zip" -d "Builds/extracted" || echo "Failed to unzip artifact" # Move extracted content up to Builds directory mv Builds/extracted/* Builds/ 2>/dev/null || true else echo "API download failed or resulted in empty file" # Try direct URL to the workflow artifact rm -f "Builds/macos-build.zip" 2>/dev/null || true curl -s -H "Authorization: token $TOKEN" \ -L "https://luckyrobots.com/$REPO/actions/artifacts/download/$ARTIFACT_NAME" \ -o "Builds/macos-build.zip" || echo "Direct download failed too" if [ -f "Builds/macos-build.zip" ] && [ $(stat -f%z "Builds/macos-build.zip") -gt 100 ]; then echo "Successfully downloaded artifact via direct URL" mkdir -p Builds/extracted unzip -o "Builds/macos-build.zip" -d "Builds/extracted" || echo "Failed to unzip artifact" # Move extracted content up to Builds directory mv Builds/extracted/* Builds/ 2>/dev/null || true else echo "Could not download artifacts automatically" fi fi # First check if there are any build artifacts in the local Builds directory if [ ! -d "Builds" ] || [ -z "$(ls -A Builds)" ]; then echo "No build artifacts found in repository, creating empty directory" mkdir -p Builds else echo "Found local build artifacts" fi # Create .zip files of any .app directories find Builds -type d -name "*.app" | while read app; do echo "Creating zip of $app" (cd $(dirname "$app") && zip -r "$(basename "$app").zip" "$(basename "$app")") done echo "Available release files:" find Builds -type f -name "*.zip" || echo "No zip files found" - name: Create Tag if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' run: | TAG="v${{ github.run_number }}" echo "Creating git tag: $TAG" # Configure git with token authentication git config --global user.email "actions@gitea.com" git config --global user.name "Gitea Actions" # Direct token approach - simplest method git remote set-url origin "https://goran:${{ secrets.GITEATOKEN }}@luckyrobots.com/goran/lyra_game_ue.git" # Set git to not prompt for input export GIT_TERMINAL_PROMPT=0 # Check if tag exists if ! git rev-parse "$TAG" >/dev/null 2>&1; then # Create tag without opening editor (-m flag) git tag -a "$TAG" -m "Release $TAG" # Push with timeout and debug echo "Pushing tag $TAG to origin..." git push --verbose origin "$TAG" || { echo "Error: Failed to push tag. Check your token permissions." exit 1 } echo "Successfully created and pushed tag: $TAG" else echo "Tag $TAG already exists, skipping tag creation" fi echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV - name: Create Gitea Release if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' uses: https://luckyrobots.com/actions/gitea-release-action@main with: token: ${{ secrets.GITEATOKEN }} tag_name: ${{ env.RELEASE_TAG }} title: "Release ${{ env.RELEASE_TAG }}" files: | Builds/*.zip Builds/**/*.zip