Skip to content

Commit bb0b0e3

Browse files
committed
ci: add publish workflow (on tags)
1 parent 2c0b146 commit bb0b0e3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/publish-release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout latest code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
20+
- name: Setup build cache
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
25+
restore-keys: |
26+
${{ runner.os }}-gradle-
27+
- name: Publish artifact
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# The GITHUB_REF tag comes in the format 'refs/tags/xxx'.
32+
# So if we split on '/' and take the 3rd value, we can get the release name.
33+
run: |
34+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
35+
echo "New version: ${NEW_VERSION}"
36+
echo "Github username: ${GITHUB_ACTOR}"
37+
./gradlew -Pversion=${NEW_VERSION} publish

0 commit comments

Comments
 (0)