-
Notifications
You must be signed in to change notification settings - Fork 78
96 lines (82 loc) · 3.04 KB
/
release.yaml
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
#
# Copyright 2022 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Release
on:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
release-sbt:
runs-on: ubuntu-latest
name: Release Scala artifacts
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
- name: Prepare the release branch
run: |
VERSION=$(grep "ThisBuild / version" version.sbt | cut -d\" -f2 | sed 's/-SNAPSHOT//')
git config --global user.email "[email protected]"
git config --global user.name "CI/CD bot"
git checkout -b release/$VERSION
git push --set-upstream origin release/$VERSION
- name: Setup JDK and sbt
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: sbt
- name: Import GPG Key
run: |
echo "${{ secrets.ABSA_OSS_CI_CD_BOT_GPG_KEY }}" > gpg-secret-key.asc
gpg --import --batch gpg-secret-key.asc && rm -rf gpg-secret-key.asc
mkdir -p ~/.gnupg
- name: Setup SonaType config
run: |
mkdir -p ~/.sbt/1.0
echo "${{ secrets.SONATYPE_CONFIG }}" | base64 --decode > ~/.sbt/1.0/sonatype.sbt
- name: Checkout the release branch
run: |
VERSION=$(grep "ThisBuild / version" version.sbt | cut -d\" -f2 | sed 's/-SNAPSHOT//')
git fetch origin release/$VERSION
git checkout release/$VERSION
- name: Run the release plugin
run: sbt releaseNow
create-pr:
needs: [ "release-sbt" ]
runs-on: ubuntu-latest
name: Create Pull Request
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
- name: Checkout the release branch
id: release_branch3
run: |
VERSION=$(grep "ThisBuild / version" version.sbt | cut -d\" -f2 | sed 's/-SNAPSHOT//')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
git config --global user.email "[email protected]"
git config --global user.name "CI/CD bot"
git fetch origin release/$VERSION
git checkout release/$VERSION
- name: Create Pull Request
run: gh pr create -B master -H "release/$VERSION" --title "Release Cobrix v$VERSION" --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.release_branch3.outputs.VERSION }}