-
Notifications
You must be signed in to change notification settings - Fork 405
63 lines (63 loc) · 2.62 KB
/
github-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
name: Release Kyma
on: workflow_dispatch
jobs:
release:
name: Release
runs-on: ubuntu-latest
environment:
name: release
container:
image: europe-docker.pkg.dev/kyma-project/prod/test-infra/githubrelease:v20230731-ca8ffad9
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if not in master
id: check_if_master
shell: bash
run: |
if ! [[ "${{ github.ref }}" =~ ^refs/heads/release-.*$ ]] ; then
echo "Job must run against a release branch. Stopping."
exit 1
fi
- name: Check if already released
id: check_release
shell: bash
run: |
NEXT_RELEASE=$(cat "VERSION")
if [[ $NEXT_RELEASE == main ]]; then
echo "You can't create a release with the version set to 'main'"
exit 1
fi
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/releases/tags/"${NEXT_RELEASE}")
if [[ $RESPONSE != 404* ]]; then
echo "The ${NEXT_RELEASE} is already published on github. Stopping."
exit 1
fi
- name: Generate changelog
id: changelog
shell: bash
env:
CONFIG_FILE: .github/package.json
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory '*'
git config --global user.email "[email protected]"
git config --global user.name "Kyma Bot"
export NEW_RELEASE_TITLE="$(cat "VERSION")"
export FROM_TAG=$(git describe --tags $(git rev-list --tags) --always | grep -F . | grep -v "-" | head -1)
/app/generate-release-changelog.sh
- name: Make Kyma release
id: make_release
env:
GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GOOGLE_APPLICATION_CREDENTIALS: 'creds.json'
run: |
echo $GOOGLE_APPLICATION_CREDENTIALS_JSON | base64 -d > creds.json
/githubrelease -targetCommit=${{ github.ref }} \
-kymaChangelog=.changelog/release-changelog.md \
-githubRepoOwner=${{ github.event.repository.owner.login }} \
-githubRepoName=${{ github.event.repository.name }} \
-githubAccessToken=${{ secrets.GITHUB_TOKEN }} \
-releaseVersionFilePath=VERSION