Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit c464092

Browse files
authored
Refactor GitHub Actions (#33)
* refactor actions * release 2.0.1 for testing * add debug logging * use local gradle.properties in actions * add step for granting gradle execution permissions * remove debug logging * improve readability * print latest commit * disable publish to maven central * use local gradle.properties * test - test - this is a test, which tests if the commit message is correctly printed * test - test - test - test * action now uses the commit message with a version change as release message * Update gradle.properties * debug logging * uncomment maven central publish step * revert version to 2.0.0
1 parent 4e8f8e4 commit c464092

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

.github/workflows/gradle.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Java CI with Gradle
1+
name: Java CI with Gradle for building, releasing and publishing
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
workflow_dispatch:
77

88
jobs:
@@ -12,43 +12,39 @@ jobs:
1212
version: ${{ steps.version.outputs.version }}
1313
tags: ${{ steps.tags.outputs.tags }}
1414
steps:
15-
- uses: actions/checkout@v2
1615
- name: get current version
17-
run: |
18-
echo ::set-output name=version::$(grep -Po '(?<=VERSION_NAME=).*' ./gradle.properties)
1916
id: version
20-
- name: get old version-tags
21-
run: |
22-
echo ::set-output name=tags::$(curl -s https://api.github.com/repos/yanndroid/oneui-design-library/tags | grep -Po '(?<="name": ").*(?=")')
17+
run: echo ::set-output name=version::$(curl -s https://raw.githubusercontent.com/yanndroid/OneUI-Design-Library/master/gradle.properties | grep -Po '(?<=VERSION_NAME=).*')
18+
- name: get previous version tags
2319
id: tags
20+
run: 'echo ::set-output name=tags::$(curl -s https://api.github.com/repos/yanndroid/oneui-design-library/tags | grep -Po ''(?<="name": ").*(?=")'')'
2421

2522
publish:
26-
runs-on: ubuntu-latest
23+
name: build and publish
2724
needs: versions
25+
runs-on: ubuntu-latest
2826
if: ${{ !contains(needs.versions.outputs.tags, needs.versions.outputs.version) }}
2927
steps:
30-
- uses: actions/checkout@v2
31-
- uses: actions/cache@v2
32-
with:
33-
path: |
34-
~/.gradle/caches
35-
~/.gradle/wrapper
36-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
37-
restore-keys: |
38-
${{ runner.os }}-gradle-
39-
- uses: actions/setup-java@v2
28+
- name: checkout
29+
uses: actions/checkout@v2
30+
31+
- name: java setup and gradle caching
32+
uses: actions/setup-java@v2
4033
with:
41-
distribution: 'zulu'
42-
java-version: '8'
34+
distribution: "zulu"
35+
java-version: "8"
36+
cache: "gradle"
37+
4338
- name: grant execute permission for gradlew
4439
run: chmod +x gradlew
4540

46-
- name: decode Key
41+
- name: decode key
4742
run: |
4843
echo "${{secrets.SIGNING_KEYFILE_BASE64}}" > ~/key.gpg.b64
4944
base64 -d ~/key.gpg.b64 > ~/key.gpg
5045
echo "SIGNING_KEYFILE=$(echo ~/key.gpg)" >> $GITHUB_ENV
51-
- name: assemble Release
46+
47+
- name: assemble release
5248
run: ./gradlew -p ./yanndroid/oneui assembleRelease
5349

5450
- name: publish to maven central
@@ -59,17 +55,19 @@ jobs:
5955
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
6056
SONATYPE_PWD: ${{ secrets.SONATYPE_PWD }}
6157

62-
6358
release:
64-
runs-on: ubuntu-latest
6559
needs: versions
60+
runs-on: ubuntu-latest
6661
if: ${{ !contains(needs.versions.outputs.tags, needs.versions.outputs.version) }}
6762
steps:
68-
- uses: actions/checkout@v2
6963
- name: create release
7064
uses: actions/create-release@v1
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
7167
with:
7268
release_name: ${{ needs.versions.outputs.version }}
7369
tag_name: ${{ needs.versions.outputs.version }}
74-
env:
75-
GITHUB_TOKEN: ${{ github.token }}
70+
body: |
71+
${{ github.event.head_commit.message }}
72+
73+
The latest release can be found [here](https://mvnrepository.com/artifact/io.github.yanndroid/oneui/${{ needs.versions.outputs.version }}).

0 commit comments

Comments
 (0)