I’m trying to setup runner on Forgejo instance (which is Gitea fork), it uses Github Actions syntax.
I have following yaml file:
name: Android CI
on: [push]
jobs:
build:
runs-on: high
steps:
- run: mkdir ~/.gradle/
- run: echo "systemProp.http.proxyHost=proxy.domain.com" > ~/.gradle/gradle.properties
- run: echo "systemProp.https.proxyHost=proxy.domain.com" >> ~/.gradle/gradle.properties
- run: echo "systemProp.http.proxyPort=9999" >> ~/.gradle/gradle.properties
- run: echo "systemProp.https.proxyPort=9999" >> ~/.gradle/gradle.properties
- run: cat ~/.gradle/gradle.properties
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: set up JDK 1.8
uses: https://github.com/actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew assembleDebug
It works, but it looks very crude. It’s likely my knowledge of Github Action syntax is too low to make creating and filling gradle.properties in 1 command.
Please advice how to do this correctly.
Attempt to do like in Create a file in GitHub action
One of correct ways:
name: Android CI on Push
run-name: On Push Android CI by @${{ github.actor }}
on: [push,fork]
# manually run from the Actions tab
workflow_dispatch:
env:
https_proxy: secureproxy.internal:9999
http_proxy: secureproxy.internal:9999
use_proxy: yes
no_proxy: localhost,*.org,*.net,*.com,*.io,*.google
jobs:
build:
runs-on: high
steps:
- name: set up JDK
uses: https://github.com/actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: Prepare android sdk...
run: |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "extras;android;m2repository"
- name: Install HTTP Toolkit's intercept CA
run: |
wget -S https://amiusing.httptoolkit.tech/certificate --no-check-certificate -O ~/intercept_ca.crt
sudo apt-get install -y ca-certificates
sudo cp ~/*.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
echo Import certficate to local jdk at $JAVA_HOME
sudo keytool -delete -trustcacerts -cacerts -storepass changeit -noprompt -alias intercept_ca || true
sudo keytool -import -trustcacerts -cacerts -storepass changeit -noprompt -alias intercept_ca -file ~/intercept_ca.crt
- name: Prepare system-wide gradle.properties
run: |
mkdir ~/.gradle/
cat <<EOF > ~/.gradle/gradle.properties
systemProp.gradle.wrapperUser=TO_BE_FILLEDNOSUCHUSER_GP_GIT@corp.internal
systemProp.gradle.wrapperPassword=TO_BE_FILLED
systemProp.http.proxyHost=secureproxy.internal
systemProp.https.proxyHost=secureproxy.internal
systemProp.http.proxyPort=9999
systemProp.https.proxyPort=9999
- name: Validating system-wide gradle.properties
run: cat ~/.gradle/gradle.properties
- name: Checkout
uses: https://github.com/actions/checkout@v4
- name: Build with Gradle
run: |
echo Building...
./gradlew assembleDebug --no-daemon
tabs and spaces are extremly important