-
Notifications
You must be signed in to change notification settings - Fork 34
106 lines (95 loc) · 3.32 KB
/
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
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
name: Release
on:
workflow_dispatch:
inputs:
incrementLevel:
description: 'Version level to increment'
required: true
type: choice
options:
- incrementPatch
- incrementMinor
- incrementMajor
default: 'incrementPatch'
schedule:
- cron: '0 9 * * 2' # every Tuesday at 9 am UTC
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
name: Setup Java
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: Setup Gradle Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Test
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_ORG_NAME: ${{ secrets.SNYK_ORG_NAME }}
run: |
./gradlew test verifyPlugin clean
git clean -d --force
git reset --hard
- name: Create Tag
id: createTag
if: ${{ !env.ACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for cron run we have empty `inputs.incrementLevel`
# see if-then-else alternatives https://stackoverflow.com/questions/60916931/github-action-does-the-if-have-an-else
run: |
if [[ '${{ inputs.incrementLevel }}' != '' ]]; then
./gradlew release -Prelease.versionIncrementer=${{ inputs.incrementLevel }}
else
./gradlew release
fi
echo "::set-output name=tagName::$(./gradlew cV -q -Prelease.quiet)"
- name: Create Tag - Dry Run
id: createTagDry
if: ${{ env.ACT }}
run: |
./gradlew release -Prelease.dryRun
echo "::set-output name=tagName::$(./gradlew cV -q -Prelease.quiet)"
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
if: ${{ !env.ACT }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.createTag.outputs.tagName }}"
release_name: "v${{ steps.createTag.outputs.tagName }}"
draft: false
prerelease: false
body: "${{ steps.extract-release-notes.outputs.release_notes }}"
- name: Publish Plugin
if: ${{ !env.ACT }}
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
ORG_GRADLE_PROJECT_amplitudeExperimentApiKey: ${{ secrets.AMPLITUDE_EXPERIMENT_API_KEY }}
ORG_GRADLE_PROJECT_environment: "PRODUCTION"
ORG_GRADLE_PROJECT_iterativelyEnvironment: "PRODUCTION"
ORG_GRADLE_PROJECT_segmentWriteKey: ${{ secrets.SEGMENT_WRITE_KEY }}
run: ./gradlew publishPlugin
# - name: Create Sentry release
# uses: getsentry/action-release@v1
# if: ${{ !env.ACT }}
# env:
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}