-
Notifications
You must be signed in to change notification settings - Fork 22
121 lines (100 loc) · 4.28 KB
/
release-new-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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 18
uses: actions/setup-java@v3
with:
java-version: '18'
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 project APK / AAR / JAR
run: ./gradlew build
#####################
# 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