-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (70 loc) · 2.45 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
name: build
concurrency: release
on:
push:
branches: ["master"]
permissions:
contents: write
env:
SERVICE_NAME: account
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
# TODO: create a separate job that would submit the dependency graph. Having this here prevents config cache reuse in branch builds.
dependency-graph: generate-and-submit
- name: Build
run: ./gradlew build --stacktrace --scan
env:
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: runtimeClasspath
- name: Upload code coverage report to coveralls
run: ./gradlew codeCoverageReport coveralls --no-configuration-cache
env:
COVERALLS_REPO_TOKEN: ${{secrets.COVERALLS_REPO_TOKEN}}
GITHUB_DEPENDENCY_GRAPH_ENABLED: false
# TODO: below need refactoring to not use ::set-output
- name: Prepare Release
id: release_config
run: |
git fetch --unshallow
echo "::set-output name=version::$(infrastructure/next-version.sh)"
changes="$(infrastructure/changes-since-last-release.sh)"
echo $changes
changes="${changes//'%'/'%25'}"
changes="${changes//$'\n'/'%0A'}"
changes="${changes//$'\r'/'%0D'}"
echo $changes
echo "::set-output name=changes::$changes"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_config.outputs.version }}
release_name: ${{ steps.release_config.outputs.version }}
body: |
${{ steps.release_config.outputs.changes }}
draft: false
- name: Publish
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }}
VERSION: ${{ steps.release_config.outputs.version }}
run: |
docker tag ${SERVICE_NAME}:snapshot $DOCKER_USER/$SERVICE_NAME:$VERSION
docker tag ${SERVICE_NAME}:snapshot $DOCKER_USER/$SERVICE_NAME
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
docker push $DOCKER_USER/$SERVICE_NAME:$VERSION
docker push $DOCKER_USER/$SERVICE_NAME