Skip to content

Update build.yml

Update build.yml #7

Workflow file for this run

name: Build
env:
Artifacts: app/build/outputs/apk/debug/*.apk
Branch: ${{github.ref_name}}
on:
push:
Branches: $Branch
pull_request:
Branches: $Branch
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get current date, commit hash and count
run: |
echo "CommitHashShort=$(git rev-parse --short=8 HEAD)" >> $env:GITHUB_ENV
echo "CommitDate=$(git show -s --date=iso-local --format=%cd)" >> $env:GITHUB_ENV
echo "CommitCount=$(git rev-list --count HEAD)" >> $env:GITHUB_ENV
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --warning-mode all
- name: List files
run: ls -R
- name: Upload Installer Artifact to GitHub
uses: actions/upload-artifact@v2
with:
name: "${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}"
path: "${{github.workspace}}/${{env.Artifacts}}/"
- name: GitHub pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: true
title: "[${{env.CommitDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
files: "${{github.workspace}}/${{env.Artifacts}}"
- name: GitHub pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "r${{env.CommitCount}}"
prerelease: true
title: "[${{env.CommitDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
files: "${{github.workspace}}/${{env.Artifacts}}"