-
Notifications
You must be signed in to change notification settings - Fork 67
83 lines (73 loc) · 2.37 KB
/
Copy pathrelease_to_production.yml
File metadata and controls
83 lines (73 loc) · 2.37 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
name: plugin release to Production
on:
workflow_call:
inputs:
plugin_version:
required: true
type: string
branch_name:
required: true
type: string
package_artifact_name:
required: true
type: string
permissions:
actions: read
contents: write
jobs:
Release-To-Production:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Configure git
env:
COMMIT_AUTHOR: ${{ secrets.CI_USERNAME }}
COMMIT_EMAIL: ${{ secrets.CI_EMAIL }}
run: |
git config --global user.name "$COMMIT_AUTHOR"
git config --global user.email "$COMMIT_EMAIL"
- name: Download production packages
uses: actions/download-artifact@v4
with:
name: ${{ inputs.package_artifact_name }}
path: .
- name: Create production GitHub release with assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ inputs.plugin_version }}
TAG: v${{ inputs.plugin_version }}
run: |
set -euo pipefail
REGULAR="appsflyer-unity-plugin-${VERSION}.unitypackage"
STRICT="strict-mode-sdk/appsflyer-unity-plugin-strict-mode-${VERSION}.unitypackage"
test -f "$REGULAR"
test -f "$STRICT"
NOTES_FILE="$(mktemp)"
if [[ -f CHANGELOG.md ]]; then
awk -v ver="v${VERSION}" '
$0 == "## " ver { found=1; next }
found && /^## / { exit }
found && /^\* / { sub(/^\* /, ""); print "- " $0 }
found && /^- / { print }
' CHANGELOG.md > "$NOTES_FILE" || true
fi
if [[ ! -s "$NOTES_FILE" ]]; then
printf 'Unity plugin %s\n' "$VERSION" > "$NOTES_FILE"
fi
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" \
--title "$TAG" \
--notes-file "$NOTES_FILE" \
--prerelease=false
else
gh release create "$TAG" \
--target master \
--title "$TAG" \
--notes-file "$NOTES_FILE"
fi
gh release upload "$TAG" "$REGULAR" "$STRICT" --clobber
rm -f "$NOTES_FILE"
echo "Published $TAG with .unitypackage assets."