Update AndroidBuild.yml #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
androidBuild: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.0 | |
- name: Setup Java SDK | |
uses: actions/setup-java@v3.13.0 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build Android with Gradle | |
run: ./gradlew :composeApp:assembleDebug | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: ResistorCalculator-KMP.apk | |
path: composeApp/build/outputs/apk/debug/composeApp-debug.apk | |
createRelease: | |
needs: androidBuild | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4.1.0 | |
- name: Set Git Identity | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
- name: Determine Version | |
id: determine_version | |
run: echo "::set-output name=version::$(date +'%Y%m%d%H%M%S')" | |
- name: Create Temporary Tag | |
run: git tag -a temp-${{ steps.determine_version.outputs.version }} -m "Temporary Tag" | |
- name: Push Temporary Tag | |
run: | | |
git push origin temp-${{ steps.determine_version.outputs.version }} --tags --quiet -u ${{ secrets.ACCESSTOKEN }} | |
echo "Pushed the temporary tag" | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: composeApp/build/outputs/apk/debug/composeApp-debug.apk | |
repo_token: ${{ secrets.ACCESSTOKEN }} | |
tag: temp-${{ steps.determine_version.outputs.version }} | |
title: Release ${{ steps.determine_version.outputs.version }} |