Add releases
Build and Test a3270 / Build Android APK (push) Successful in 4m22s
Release a3270 / Build & Publish Release (push) Successful in 6m42s

This commit is contained in:
2026-08-20 19:27:55 -04:00
parent 4b3bf1bfce
commit c0b0ae3b74
6 changed files with 327 additions and 80 deletions
+88
View File
@@ -0,0 +1,88 @@
name: Release a3270
on:
push:
tags:
- 'v*'
jobs:
release:
name: Build & Publish Release
runs-on: ubuntu-latest
steps:
- name: Configure Dynamic DNS Resolvers
run: |
printf "nameserver 1.1.1.1\nnameserver 8.8.8.8\n" > /etc/resolv.conf 2>/dev/null || true
echo "64.22.43.251 git.hugfreevikings.wtf" | sudo tee -a /etc/hosts || echo "64.22.43.251 git.hugfreevikings.wtf" >> /etc/hosts || true
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout j3270 (for lib3270j)
run: |
git clone --depth 1 https://git.hugfreevikings.wtf/rudi/j3270.git j3270
- name: Set up Java JDK (Temurin 21)
uses: actions/setup-java@v3
continue-on-error: true
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Make scripts executable
run: |
chmod +x ./gradlew ./build.sh
- name: Build Android APK
run: |
./gradlew assembleDebug --no-daemon
env:
J3270_DIR: ${{ github.workspace }}/j3270
- name: Upload Release Artifact
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: a3270-${{ github.ref_name }}
path: build/outputs/apk/debug/a3270-debug.apk
- name: Publish Release to Gitea
continue-on-error: true
run: |
TAG="${{ github.ref_name }}"
API_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
TOKEN="${{ secrets.GITHUB_TOKEN }}"
APK_FILE="build/outputs/apk/debug/a3270-debug.apk"
IS_PRERELEASE="false"
case "$TAG" in
*beta*|*alpha*|*rc*|*pre*|*preview*|*dev*)
IS_PRERELEASE="true"
echo "Tag $TAG detected as pre-release / beta."
;;
esac
echo "Creating Release for tag $TAG (prerelease=$IS_PRERELEASE)..."
RESPONSE=$(curl -s -X POST "$API_URL" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG\", \"name\": \"a3270 $TAG\", \"body\": \"Automated release for **$TAG**.\n\n### Installing a3270\n```bash\nadb install -r a3270.apk\n```\", \"draft\": false, \"prerelease\": $IS_PRERELEASE}")
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -n 1 | cut -d':' -f2)
if [ -n "$RELEASE_ID" ] && [ -f "$APK_FILE" ]; then
echo "Uploading $APK_FILE to release $RELEASE_ID as a3270.apk..."
curl -s -X POST "$API_URL/$RELEASE_ID/assets?name=a3270.apk" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/vnd.android.package-archive" \
--data-binary @"$APK_FILE"
echo "Release $TAG published with a3270.apk attached successfully!"
else
echo "Release API response: $RESPONSE"
fi