Skip to content

Commit

Permalink
update upload script
Browse files Browse the repository at this point in the history
  • Loading branch information
wswebcreation committed Jan 1, 2024
1 parent b54700d commit 8a7b01f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ RELEASE_ID=$(echo $RESPONSE | jq -r ".id")

if [ "$RELEASE_ID" != "null" ]; then
echo "Release created successfully! ID: $RELEASE_ID"
ASSET_URL=$(echo $RESPONSE | jq -r ".upload_url")
ASSET_URL="${ASSET_URL%\{*}"
echo "ASSET_URL=$ASSET_URL" >> $GITHUB_ENV
else
echo "Failed to create release"
echo "Response:"
Expand Down
25 changes: 25 additions & 0 deletions .github/scripts/upload_artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Variables passed from the workflow
ASSET_URL=$1
NEW_VERSION=$2
GITHUB_TOKEN=$3

# Trim off the end of the URL
ASSET_URL="${ASSET_URL%\{*}"

echo "Uploading Android App..."
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type ./android.wdio.native.app.$NEW_VERSION.apk)" \
--data-binary @./android.wdio.native.app.$NEW_VERSION.apk \
"$ASSET_URL?name=android.wdio.native.app.$NEW_VERSION.apk"

echo "Uploading iOS App..."
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type ./ios.simulator.wdio.native.app.$NEW_VERSION.zip)" \
--data-binary @./ios.simulator.wdio.native.app.$NEW_VERSION.zip \
"$ASSET_URL?name=ios.simulator.wdio.native.app.$NEW_VERSION.zip"
19 changes: 2 additions & 17 deletions .github/workflows/publish.apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ASSET_URL="${{ steps.create_release.outputs.upload_url }}"
ASSET_URL="${ASSET_URL%\{*}"
echo "Uploading Android App..."
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type ./android.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.apk)" \
--data-binary @./android.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.apk \
"$ASSET_URL?name=android.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.apk"
echo "Uploading iOS App..."
curl \
-X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: $(file -b --mime-type ./ios.simulator.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.zip)" \
--data-binary @./ios.simulator.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.zip \
"$ASSET_URL?name=ios.simulator.wdio.native.app.${{ needs.prepare_release.outputs.new_version }}.zip"
chmod +x .github/scripts/upload_artifacts.sh "${{ env.ASSET_URL }}" ${{ needs.prepare_release.outputs.new_version }} ${{ secrets.GITHUB_TOKEN }}
.github/scripts/upload_artifacts.sh
cleanup:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 8a7b01f

Please sign in to comment.