-
Notifications
You must be signed in to change notification settings - Fork 15
168 lines (163 loc) · 5.83 KB
/
release.yml
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#
# Copyright Avast Software. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: "wallet-sdk release"
env:
GO_VERSION: '1.22'
on:
push:
tags:
- '*'
jobs:
PublishAndroidSDKRelease:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Derive the new version
run: |
echo "new version"
NEW_VER=$(git describe --tags --always `git rev-list --tags --max-count=1`)
echo $NEW_VER
- name: Generate Binding
run: |
export PATH=$PATH:$GOPATH/bin
echo $PATH
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
NEW_VERSION=$NEW_VER GIT_REV=$(git rev-parse HEAD) BUILD_TIME=$(date) make generate-android-bindings
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/work/wallet-sdk/go
- name: Upload Android bindings to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: android-binding
path: ./cmd/wallet-sdk-gomobile/bindings/android
- name: Publish
run: |
export USER=$USER
export TOKEN=$TOKEN
export ANDROID_GROUP_ID=dev.trustbloc
export ANDROID_ARTIFACT_ID=vc-wallet-sdk
TAG=$(git describe --tags --always `git rev-list --tags --max-count=1`)
export ANDROID_VERSION=$TAG
export PROJECT_PKG_REPO=https://maven.pkg.github.com/trustbloc/wallet-sdk
echo $ANDROID_VERSION
gradle publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER: ${{ secrets.CR_USER }}
TOKEN: ${{ secrets.CR_PAT }}
PublishIosSDKRelease:
needs: [ PublishAndroidSDKRelease ]
runs-on: macos-latest
timeout-minutes: 40
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Build Custom GO
run: |
cd ..
git clone https://go.googlesource.com/go goroot
cd goroot
git checkout go1.22.2
cp ../wallet-sdk/cmd/wallet-sdk-gomobile/gopatches/* ./
git apply cmd_cgo__fix_unaligned_arguments_typedmemmove_crash_on_iOS.patch
cd src && ./all.bash
- name: Derive the new version
run: |
echo "new version"
NEW_VER=$(git describe --tags --always `git rev-list --tags --max-count=1`)
echo "NEW_VERSION=$NEW_VER-swift-pm" >> $GITHUB_ENV
echo $NEW_VER
- name: Generate Binding
run: |
echo $PATH
echo ${{ github.workspace }}
echo ${GOPATH}
echo ${GOROOT}
export PATH=$GOPATH/bin:$PATH
echo $PATH
which go
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
NEW_VERSION=$NEW_VER GIT_REV=$(git rev-parse HEAD) BUILD_TIME=$(date) make generate-ios-bindings
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /Users/runner/work/wallet-sdk/goroot
- name: Upload iOS bindings to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: ios-binding
path: ./cmd/wallet-sdk-gomobile/bindings/ios
- name: Zip walletsdk framework
run: |
cd ./cmd/wallet-sdk-gomobile/bindings/ios
zip -r -X walletsdk.xcframework.zip walletsdk.xcframework
- name: Clone walletsdk release repository
uses: actions/checkout@v2
with:
repository: trustbloc/wallet-sdk
ref: swift-pm
path: ios
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and commit walletsdk xcframework package
run: |
cp -r ./cmd/wallet-sdk-gomobile/bindings/ios/walletsdk.xcframework.zip ./ios/walletsdk.xcframework.zip
cd ios/
ls -lrt
echo "calculate new checksum"
NEW_CHECKSUM=$(swift package compute-checksum $FRAMEWORK_NAME.xcframework.zip)
echo "moduleName=$FRAMEWORK_NAME version=$NEW_VERSION checksum=$NEW_CHECKSUM"
echo "replace name module information in package manifest"
sed -E -i '' 's/let moduleName = ".+"/let moduleName = "'$FRAMEWORK_NAME\"/ Package.swift
echo "replace version information in package manifest"
sed -E -i '' 's/let version = ".+"/let version = "'$NEW_VERSION\"/ Package.swift
echo "replace checksum information in package manifest"
sed -E -i '' 's/let checksum = ".+"/let checksum = "'$NEW_CHECKSUM\"/ Package.swift
echo "Package.swift content file after update"
cat Package.swift
echo "git commit all without framework and push"
git status
git add Package.swift
git commit -m "New $FRAMEWORK_NAME version $NEW_VERSION"
git push
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FRAMEWORK_NAME: walletsdk
NEW_VERSION: '${{ env.NEW_VERSION }}'
- name: Tag and Release new version Swift package
uses: softprops/action-gh-release@v1
with:
draft: false
tag_name : ${{ env.NEW_VERSION }}
repository : trustbloc/wallet-sdk
target_commitish : swift-pm
files: |
ios/walletsdk.xcframework.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}