-
Notifications
You must be signed in to change notification settings - Fork 17
152 lines (138 loc) · 4.79 KB
/
Copy pathrelease.yml
File metadata and controls
152 lines (138 loc) · 4.79 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
name: "Create Release"
on:
workflow_run:
workflows: ["Tag Release"]
types:
- completed
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
lfs: true
ref: ${{ env.LATEST_TAG }}
- name: Get the latest tag
run: |
git fetch --tags
LATEST_TAG="$(git tag --sort=-creatordate | head -n 1)"
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
if [[ "$LATEST_TAG" == audience/* ]]; then
echo "IS_AUDIENCE=true" >> "$GITHUB_ENV"
PREV_TAG="$(git tag --sort=-creatordate | grep "^audience/" | sed -n '2p')"
else
echo "IS_AUDIENCE=false" >> "$GITHUB_ENV"
PREV_TAG="$(git tag --sort=-creatordate | grep -v "^audience/" | sed -n '2p')"
fi
echo "PREV_TAG=${PREV_TAG}" >> "$GITHUB_ENV"
if [[ "$LATEST_TAG" == *alpha* ]]; then
echo "IS_PRERELEASE=true" >> "$GITHUB_ENV"
else
echo "IS_PRERELEASE=false" >> "$GITHUB_ENV"
fi
- name: Pull LFS
run: git lfs pull
- name: Build Changelog (Audience)
id: github_release_audience
if: env.IS_AUDIENCE == 'true'
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fromTag: ${{ env.PREV_TAG }}
toTag: ${{ env.LATEST_TAG }}
configurationJson: |
{
"pr_template": "- #{{TITLE}} (##{{NUMBER}})",
"categories": [
{
"title": "## Features",
"labels": ["audience-feature"]
},
{
"title": "## Fixes",
"labels": ["audience-fix"]
},
{
"title": "## Performance",
"labels": ["audience-performance"]
},
{
"title": "## Documentation",
"labels": ["audience-docs"]
},
{
"title": "## Chores",
"labels": ["audience-chore"]
}
]
}
- name: Build Changelog (Passport)
id: github_release_passport
if: env.IS_AUDIENCE != 'true'
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fromTag: ${{ env.PREV_TAG }}
toTag: ${{ env.LATEST_TAG }}
configurationJson: |
{
"pr_template": "- #{{TITLE}} (##{{NUMBER}})",
"categories": [
{
"title": "## Features",
"labels": ["feature", "feat"]
},
{
"title": "## Fixes",
"labels": ["fix"]
},
{
"title": "## Performance",
"labels": ["performance"]
},
{
"title": "## Documentation",
"labels": ["docs"]
},
{
"title": "## Chores",
"labels": ["chore"]
}
]
}
- name: Extract TS SDK version from index.html
if: env.IS_AUDIENCE != 'true'
id: extract_ts_sdk_version
run: |
version=$(grep -oP '"x-sdk-version":"ts-immutable-sdk-\K[0-9]+\.[0-9]+\.[0-9]+' ./src/Packages/Passport/Runtime/Resources/index.html | head -n 1)
if [[ -z "$version" ]]; then
echo "Error: Version not found in index.html" >&2
exit 1
fi
version=$(echo "$version" | tr -d '\r\n')
echo "TS_SDK_VERSION=${version}" >> "$GITHUB_ENV"
- name: Build release body suffix
run: |
if [[ "$IS_AUDIENCE" != "true" && -n "$TS_SDK_VERSION" ]]; then
echo "RELEASE_BODY_SUFFIX=Game bridge built from Immutable Typescript SDK version $TS_SDK_VERSION" >> "$GITHUB_ENV"
else
echo "RELEASE_BODY_SUFFIX=" >> "$GITHUB_ENV"
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.LATEST_TAG }}
release_name: ${{ env.LATEST_TAG }}
body: |
${{steps.github_release_audience.outputs.changelog}}${{steps.github_release_passport.outputs.changelog}}
${{ env.RELEASE_BODY_SUFFIX }}
draft: false
prerelease: ${{ env.IS_PRERELEASE }}