Add releases
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
name: Build and Test a3270
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "master", "develop" ]
|
||||
pull_request:
|
||||
branches: [ "main", "master" ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Android APK
|
||||
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 a3270 APK Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: a3270-debug
|
||||
path: build/outputs/apk/debug/a3270-debug.apk
|
||||
|
||||
- name: Report Build Status
|
||||
if: failure()
|
||||
run: |
|
||||
echo "### ❌ Build Failed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Please check the runner logs above for details." >> $GITHUB_STEP_SUMMARY
|
||||
@@ -1,51 +0,0 @@
|
||||
name: Build a3270 APK
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Android APK
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Configure DNS and Hosts
|
||||
run: |
|
||||
echo "64.22.43.251 git.hugfreevikings.wtf" | sudo tee -a /etc/hosts || echo "64.22.43.251 git.hugfreevikings.wtf" >> /etc/hosts || true
|
||||
echo "nameserver 1.1.1.1" | sudo tee -a /etc/resolv.conf || echo "nameserver 1.1.1.1" >> /etc/resolv.conf || true
|
||||
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf || echo "nameserver 8.8.8.8" >> /etc/resolv.conf || true
|
||||
|
||||
- name: Checkout a3270
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout j3270 (for lib3270j)
|
||||
run: |
|
||||
git clone --depth 1 https://git.hugfreevikings.wtf/rudi/j3270.git j3270
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build Debug APK
|
||||
run: ./gradlew assembleDebug --no-daemon
|
||||
env:
|
||||
J3270_DIR: ${{ github.workspace }}/j3270
|
||||
|
||||
- name: Upload APK Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: a3270-debug
|
||||
path: build/outputs/apk/debug/a3270-debug.apk
|
||||
if-no-files-found: error
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user