Fix(githubAction): assemble after build #43
Workflow file for this run
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: "GLPI Android Inventory Library Release" | |
env: | |
module_java: example_java | |
module_kotlin: example_kotlin | |
module_inventory: inventory | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Android-Inventory-Library Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: develop | |
fetch-depth: 0 #To Fetch All Tags and Branches | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: Install Dependencies | |
uses: php-actions/composer@v6 | |
with: | |
dev: no | |
- name: "Extract Current Tag Name" | |
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: "Update Release Version" | |
run: echo "$(jq '.version = "${{ env.tag_name }}"' package.json)" > package.json | |
- name: Extract Previous Tag Name | |
run: echo "previous_tag_name=$(git tag --sort=taggerdate | tail -1)" >> $GITHUB_ENV | |
- name: Set Up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
############################################## | |
# Prepare / Build project APK / AAR / JAR # | |
############################################## | |
# Grant execute permission for gradlew | |
- name: Grant Execute Permission For Gradlew | |
run: chmod +x gradlew | |
# Build app | |
- name: Build for run tests or static analysis | |
run: ./gradlew build | |
- name: Build project APK / AAR / JAR | |
run: ./gradlew assemble | |
##################### | |
# Prepare release # | |
##################### | |
- name: "Extract Full ChangeLog (Conventional Commit)" | |
run: | | |
{ | |
echo 'full_change_log<<EOF' | |
./vendor/bin/robo build:log 0.9 HEAD | |
echo EOF | |
} >> "$GITHUB_ENV" | |
- name: "Update Full ChangeLog" | |
run: echo "${{ env.full_change_log }}" > CHANGELOG.md | |
- name: Update develop branch | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
add: "['CHANGELOG.md', 'package.json']" #only this files will be added | |
push: origin HEAD:develop | |
message: "ci(release): release new version ${{ env.tag_name }}" | |
- name: Merge develop -> master | |
uses: devmasx/merge-branch@master | |
with: | |
type: now | |
from_branch: develop | |
target_branch: master | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Extract Clean Git Log (Conventional Commit)" | |
run: | | |
{ | |
echo 'release_body<<EOF' | |
./vendor/bin/robo build:log ${{ env.previous_tag_name }} HEAD 0 | |
echo EOF | |
} >> "$GITHUB_ENV" | |
- name: "Rename ${{ env.module_java }} APK" | |
run: mv ${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-release-unsigned.apk ${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-v${{ env.tag_name }}.apk | |
- name: "Rename ${{ env.module_kotlin }} APK" | |
run: mv ${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-release-unsigned.apk ${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-v${{ env.tag_name }}.apk | |
- name: "Rename ${{ env.module_inventory }} AAR" | |
run: mv ${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release.aar ${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release-v${{ env.tag_name }}.aar | |
- name: "Rename ${{ env.module_inventory }} JAR" | |
run: mv ${{ env.module_inventory }}/build/libs/${{ env.module_inventory }}-sources.jar ${{ env.module_inventory }}/build/libs/${{ env.module_inventory }}-sources-v${{ env.tag_name }}.jar | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name : Inventory Engine v${{ env.tag_name }} | |
draft : true | |
body : ${{ env.release_body }} | |
files: | | |
${{ env.module_java }}/build/outputs/apk/release/${{ env.module_java }}-v${{ env.tag_name }}.apk | |
${{ env.module_kotlin }}/build/outputs/apk/release/${{ env.module_kotlin }}-v${{ env.tag_name }}.apk | |
${{ env.module_inventory }}/build/outputs/aar/${{ env.module_inventory }}-release-v${{ env.tag_name }}.aar | |
${{ env.module_inventory }}/build/libs/${{ env.module_inventory }}-sources-v${{ env.tag_name }}.jar |