This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
78 lines (66 loc) · 2.06 KB
/
continuous-integration-and-deployment.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
name: Continuous integration and deployment
on:
push:
branches:
- master
tags:
- 'milestone/*'
- 'release/*'
pull_request:
branches:
- master
jobs:
pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Copy build distribution
run: cp build/distributions/*.zip golo-distribution.zip
- name: Attach build distribution from this build
uses: actions/upload-artifact@v2
with:
name: Golo distribution from this build
path: ./golo-distribution.zip
# Only pushes to master trigger a publication to Sonatype OSS
- name: Deploy
if: github.ref == 'refs/heads/master'
run: .build/deploy.sh
env:
GPG_SECRET: ${{ secrets.GPG_SECRET }}
# Only pushes of tags trigger a release creation
- name: Create the release
id: create_release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: startsWith(github.ref, 'refs/tags/milestone/')
- name: Attach build distribution to the release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./golo-distribution.zip
asset_name: golo-distribution.zip
asset_content_type: application/zip