-
Notifications
You must be signed in to change notification settings - Fork 2
140 lines (119 loc) · 4.77 KB
/
gradle-publish.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
name: Publish to Maven Central
# on:
# release:
# types: [created]
on:
push:
branches: [ newPublishPipeline ]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Check if commit message starts with "release:"
id: check_commit
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
# Check if commit message starts with 'release:'
if [[ "$COMMIT_MSG" != release:* ]]; then
echo "Commit message does not start with 'release:'. Skipping workflow."
exit 0
fi
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Extract libraries from commit message
id: extract-libs
run: |
# Extract text between square brackets after [build-libs]
COMMIT_MSG="${{ github.event.head_commit.message }}"
LIBS=$(echo "$COMMIT_MSG" | grep -o '\[build-libs\]\[.*\]' | grep -o '\[.*\]$' | tr -d '[]')
if [ -z "$LIBS" ]; then
echo "No libraries specified in commit message"
exit 0
fi
echo "Found libraries: $LIBS"
echo "libraries=$LIBS" >> $GITHUB_OUTPUT
# COMMIT_MSG="${{ github.event.head_commit.message }}"
# # Check if commit message contains a valid format for libraries
# # if [[ "$COMMIT_MSG" =~ ^release:\ \[([a-zA-Z0-9, ]+)\]\ .* ]]; then
# LIBS="${BASH_REMATCH[1]}"
# echo "Found libraries: $LIBS"
# echo "libraries=$LIBS" >> $GITHUB_OUTPUT
# # else
# # echo "No valid libraries found in commit message"
# # exit 1
# # fi
- name: Enable Corepack and Install Yarn
run: |
# Enable Corepack
corepack enable
# corepack prepare [email protected] --activate
- name: Dependency Install
run: |
# Create a new folder for the dependencies
mkdir -p /home/runner/work/hyperswitch-sdk-android
cd /home/runner/work/hyperswitch-sdk-android
# Download package.json from GitHub
# curl -o package.json -L https://raw.githubusercontent.com/juspay/hyperswitch-client-core/main/package.json
git clone https://github.com/juspay/hyperswitch-client-core.git
cp -r hyperswitch-client-core/* .
rm -rf thyperswitch-client-core
rm -rf android
rm -rf ios
# cat > react-native.config.js << 'EOL'
# module.exports = {
# assets: ['./assets/fonts/'],
# project: {
# android: {
# appName: 'demoapp',
# },
# },
# };
# EOL
echo "Directory structure after setup:"
ls
mv hyperswitch-sdk-android android
ls
# Install dependencies using yarn
npm i
# curl -o react-native.config.js -L https://raw.githubusercontent.com/juspay/hyperswitch-client-core/main/react-native.config.js
# curl -o rescript.json -L https://raw.githubusercontent.com/juspay/hyperswitch-client-core/main/rescript.json
npm run re:start
echo "Directory structure after downloads:"
ls
# echo "module.exports = { project: { android: { sourceDir: './android' } } };" > react-native.config.js
# # Ensure the gradle.properties file exists
# mkdir -p android && touch android/gradle.properties
# Check if the necessary build folder exists, otherwise fail
if [ ! -d "node_modules/@react-native/gradle-plugin" ]; then
echo "Included build 'node_modules/@react-native/gradle-plugin' does not exist."
# exit 1
fi
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582
- name: Build and Publish
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_FULL_SIGNING_KEY: ${{ secrets.GPG_FULL_SIGNING_KEY }}
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN_2 }}
# SELECTED_LIBRARIES: "hyperswitch-gradle-plugin,plugin"
SELECTED_LIBRARIES: ${{ steps.extract-libs.outputs.libraries }}
run: ./build-lib.sh
# - name: Upload to Maven Central
# env:
# SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
# run: ./upload-lib.sh