-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (85 loc) · 3.32 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
97
name: Tag & Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version number to be released (use semver semantic: 'X.Y.Z')"
required: true
nextDevelopmentVersion:
description: "Next development version to be set (use semver semantic: 'X.Y.Z', `-SNAPSHOT` artifact's suffix will be automatically added)"
required: true
permissions:
contents: write
deployments: write
pull-requests: write
jobs:
Releasing:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PWD
gpg-private-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: GPG_PWD
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure git
run: |
git config user.name git
git config user.email [email protected]
git config --global credential.helper cache
git config --global credential.https://github.com.username ${{ env.GITHUB_USERNAME }}
git config --global credential.https://github.com.password ${{ env.GITHUB_TOKEN }}
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create and switch to dedicated release branch
run: |
git checkout -b "release-${{ github.event.inputs.releaseVersion }}"
# e2e requirements
- name: Checkout sinch-sdk-mockserver repository
uses: actions/checkout@v3
with:
repository: sinch/sinch-sdk-mockserver
token: ${{ secrets.MOCKSERVER_REPO_PAT_CI }}
fetch-depth: 0
path: sinch-sdk-mockserver
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Start mock servers with Docker Compose
run: |
cd sinch-sdk-mockserver
docker-compose up -d
- name: Link to feature files
run: |
ln -s ${{ github.workspace }}/sinch-sdk-mockserver/features client/src/test/resources
- name: Release
run: scripts/release.sh
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
NEXT_VERSION: ${{ github.event.inputs.nextDevelopmentVersion }}
OSSRH_USER: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PWD: ${{ secrets.OSSRH_PWD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PWD: ${{ secrets.GPG_PWD }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create dedicated release pull request
run: gh pr create -d -B main -H "release-${RELEASE_VERSION}" --title "Merge release '"release-${RELEASE_VERSION}"' branch into main" --body 'Created by Github action'
env:
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}