forked from NyaMisty/action-ipadown
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (136 loc) · 6.23 KB
/
ipa.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
# vim: expandtab tabstop=2 shiftwidth=2
name: IPA Down
env:
PYTHONIOENCODING: utf-8
# Allow Release
permissions: write-all
on:
workflow_dispatch:
inputs:
appleId:
description: 'Apple ID Account'
required: true
appleIdPwd:
description: 'Apple ID Password'
required: true
operation:
description: 'Operation to do, choices: lookup, historyver, download, historyver_id, download_id'
appBundleId:
description: 'AppStore Bundle-ID (needed when using non-*_id operations)'
required: false
appCountry:
description: 'AppStore Country (needed when using non-*_id operations)'
required: false
default: 'JP'
appVerId:
description: 'App Version Id Number (for downloading history versions)'
required: false
appId:
description: 'App Id Number (needed when using *_id operations)'
required: false
debug_enabled:
description: 'Run the build with RDP debugging enabled'
required: false
default: false
itunes_debug_enabled:
description: 'Run the build with ngrok debugging enabled'
required: false
default: false
jobs:
download_ipa:
name: 'IPATool Operations'
runs-on: "windows-latest"
steps:
- name: Masking inputs
run: |
SECRET_VALUE=$(cat $GITHUB_EVENT_PATH | jq -r '.inputs.appleId' )
echo "::add-mask::$SECRET_VALUE"
SECRET_VALUE=$(cat $GITHUB_EVENT_PATH | jq -r '.inputs.appleIdPwd' )
echo "::add-mask::$SECRET_VALUE"
shell: bash
- name: Set up git repository
uses: actions/checkout@v2
- name: Setup ipatool-py
run: |
git clone -b itunes_server https://github.com/NyaMisty/ipatool-py
pip3 install -r ipatool-py/requirements.txt
mkdir -p ipaDown
shell: bash
- name: Setup iTunes Header Service
uses: NyaMisty/actions-iTunes-header@master
if: ${{ github.event.inputs.operation != 'lookup' }}
with:
apple_id: ${{ github.event.inputs.appleId }}
apple_id_pwd: ${{ github.event.inputs.appleIdPwd }}
ngrok_token: ${{ secrets.NGROK_AUTH_TOKEN }}
- name: Execute operation
id: operation
run: |
# available operations: lookup, historyver, download, historyver_id, download_id
op=${{ github.event.inputs.operation }}
if [[ "$op" == "lookup" ]]; then
if [[ "${{ github.event.inputs.appBundleId }}" != "" ]]; then
python3 ipatool-py/main.py --json lookup --get-verid -b ${{ github.event.inputs.appBundleId }} -c ${{ github.event.inputs.appCountry }}
else
python3 ipatool-py/main.py --json lookup --get-verid -i ${{ github.event.inputs.appId }} -c ${{ github.event.inputs.appCountry }}
fi
elif [[ "$op" == historyver* ]]; then
if [[ "$op" == "historyver" ]]; then
python3 ipatool-py/main.py --json lookup -b ${{ github.event.inputs.appBundleId }} -c ${{ github.event.inputs.appCountry }} \
historyver -s http://127.0.0.1:9000
elif [[ "$op" == "historyver_id" ]]; then
python3 ipatool-py/main.py --json historyver -s http://127.0.0.1:9000 --appId ${{ github.event.inputs.id }}
fi
elif [[ "$op" == download* ]]; then
if [[ "${{ github.event.inputs.appVerId }}" == "" ]]; then
appVerCmd=""
else
appVerCmd="--appVerId ${{ github.event.inputs.appVerId }}"
fi
if [[ "$op" == "download" ]]; then
output=$(python3 ipatool-py/main.py --json lookup -b ${{ github.event.inputs.appBundleId }} -c ${{ github.event.inputs.appCountry }} \
download -o ipaDown -s http://127.0.0.1:9000 $appVerCmd)
elif [[ "$op" == "download_id" ]]; then
output=$(python3 ipatool-py/main.py --json download -o ipaDown -s http://127.0.0.1:9000 --appId ${{ github.event.inputs.id }} $appVerCmd)
fi
echo "Got Downloading JSON result: $output"
echo "::set-output name=needIPARelease::1"
echo "::set-output name=appName::$(echo "$output" | jq -r '.appName')"
echo "::set-output name=appBundleId::$(echo "$output" | jq -r '.appBundleId')"
echo "::set-output name=appVer::$(echo "$output" | jq -r '.appVer')"
echo "::set-output name=appId::$(echo "$output" | jq -r '.appId')"
echo "::set-output name=appVerId::$(echo "$output" | jq -r '.appVerId')"
else
echo "Unknown Operation: $op"
fi
shell: bash
- name: "Upload package"
uses: NyaMisty/upload-artifact-as-is@master
with:
path: ipaDown\*
- name: Split ipa
if: ${{ steps.operation.outputs.needIPARelease == '1' }}
run: |
mkdir -p ipaDown_split
(cd ipaDown; find . -name "*.ipa" -size +1879048192b -exec split --bytes=1879048192 --suffix-length=3 --numeric-suffix {} ../ipaDown_split/{}. \;)
(cd ipaDown; find . -name "*.ipa" -not -size +1879048192b -exec cp -r {} ../ipaDown_split \;)
shell: bash
- name: Pushing to release
if: ${{ steps.operation.outputs.needIPARelease == 1 }}
uses: ncipollo/release-action@v1
with:
name: "IPADown: ${{ steps.operation.outputs.appName }} - ${{ steps.operation.outputs.appVer }}"
body: >-
${{ format(fromJSON('"appName: {0}\nappBundleId: {1}\nappVer: {2}\nappId: {3}\nappVerId: {4}\n"'),
steps.operation.outputs.appName,
steps.operation.outputs.appBundleId,
steps.operation.outputs.appVer,
steps.operation.outputs.appId,
steps.operation.outputs.appVerId
) }}
commit: ${{ github.sha }}
tag: "${{ steps.operation.outputs.appBundleId }}-${{ steps.operation.outputs.appId }}-${{ steps.operation.outputs.appVerId }}"
artifacts: ipaDown_split\*
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true