-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (51 loc) · 2.05 KB
/
build-dev-release.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
on:
push:
branches:
- '**'
env:
DIST_DIR: ${{ github.workspace }}/build/dist
name: Build development release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check-out source code
uses: actions/checkout@v2
- name: Define development release info
if: startsWith(github.ref, 'refs/heads/')
run: |
branch="${GITHUB_REF#refs/heads/}"
tag="dev_${branch//[^a-zA-Z0-9_.-]/.}" # Replace all special characters by a dot
echo DO_BUILD=true >> $GITHUB_ENV # We always want to do a build if we're building a branch
echo BRANCH=${branch} >> $GITHUB_ENV
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
if git ls-remote --exit-code origin refs/tags/${tag} >/dev/null 2>&1; then
echo "Found tag ${tag}, development release will be published"
echo DO_RELEASE=true >> $GITHUB_ENV
else
echo "Tag ${tag} does not exist, no development release will be published"
fi
- name: Build development release
if: env.DO_BUILD
run: ./gradlew dist distThirdParty
- name: Publish build artifacts
if: env.DO_BUILD
uses: actions/upload-artifact@v2
with:
name: build_artifacts
path: ${{ env.DIST_DIR }}
- name: Update development release tag
uses: richardsimko/update-tag@v1
if: env.DO_RELEASE
with:
tag_name: ${{ env.RELEASE_TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pre-release
if: env.DO_RELEASE
run: |
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
gh release delete ${{ env.RELEASE_TAG }} -y || true
gh release create ${{ env.RELEASE_TAG }} -p -t "Development Release - ${{ env.BRANCH }} branch" -n 'See `Assets` section below for latest build artifacts' ${files}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}