-
Notifications
You must be signed in to change notification settings - Fork 68
feat(x): manual mobileproxy release action #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fab7a6d
to
a822d14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this done so quickly.
There are a number of open questions on the release format:
- Do we want to use releases for Android, or push to the Maven repo?
- For Switch, I think the package has to be in the root and use the root version tag, which conflicts with the Go main module versioning. We might need a new repo, we need to discuss.
Given these open questions, can you turn the PR into a taskfile to build Mobileproxy for now?
fi | ||
|
||
CLONE_DIR=$(mktemp -d) | ||
trap "echo 'Cleaning up temporary clone directory: ${CLONE_DIR}'; rm -rf '${CLONE_DIR}'" EXIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this EXIT
?
echo "Cloning repository at tag ${RELEASE_TAG} into ${CLONE_DIR}..." | ||
CLONE_URL_BASE="github.com/Jigsaw-Code/outline-sdk.git" | ||
if [[ -n "${GH_TOKEN:-}" ]]; then | ||
CLONE_URL="https://x-access-token:${GH_TOKEN}@${CLONE_URL_BASE}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the token to clone a public repository. Please remove.
else | ||
CLONE_URL="https://%s@${CLONE_URL_BASE}" | ||
fi | ||
git clone --depth 1 --branch "${RELEASE_TAG}" "${CLONE_URL}" "${CLONE_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to clone? That adds complexity.
We are already in the repository. Let's just git switch
to the tag, and call:
if ! (output="$(git status --porcelain)" && [[ -z "$output" ]]); then
fail "Cloned repository is not clean. Reset changes and try again."
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if we need to use GitHub actions, we don't need to clone, GitHub will clone the repository for us.
echo "Building Mobileproxy for iOS..." | ||
( | ||
cd "${X_DIR_IN_CLONE}" | ||
gomobile bind -ldflags='-s -w' -target=ios -iosversion=11.0 -o "${IOS_FRAMEWORK_PATH}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about the duplication with the mobileproxy instructions.
Let's create a build script for the mobile proxy.
But bash is not that great. Can you migrate this to Taskfile? That was we can build things incrementally.
We can have "release" as one of the tasks, like we have in outline-ss-server:
https://github.com/Jigsaw-Code/outline-ss-server/blob/master/Taskfile.yml
Our tun2socks build illustrates how to use Tasks with Go Mobile:
https://github.com/Jigsaw-Code/outline-apps/blob/master/client/go/Taskfile.yml
The MobileProxy tasks should live in its directory, but called from the root, like we do in outline-apps:
https://github.com/Jigsaw-Code/outline-apps/blob/master/Taskfile.yml
We can then update the instructions to call the task instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to bash -> taskfile.
|
||
if [[ -n "${GH_TOKEN:-}" ]]; then | ||
echo "GH_TOKEN is set. Uploading artifacts to release tag ${RELEASE_TAG}..." | ||
gh release upload "${RELEASE_TAG}" "${IOS_ZIP_PATH}" "${ANDROID_AAR_PATH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to release Android to Maven instead, so users don't need jitpack: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry
In that case, perhaps we don't want to use this release mode and support two different ways.
echo "Zipping Mobileproxy.xcframework for iOS..." | ||
( | ||
cd "${MOBILEPROXY_ARTIFACT_DIR}" | ||
zip -qr "$(basename "${IOS_ZIP_PATH}")" "$(basename "${IOS_FRAMEWORK_PATH}")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to add the Swift package too.
echo "Building Mobileproxy for iOS..." | ||
( | ||
cd "${X_DIR_IN_CLONE}" | ||
gomobile bind -ldflags='-s -w' -target=ios -iosversion=11.0 -o "${IOS_FRAMEWORK_PATH}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to bash -> taskfile.
else | ||
CLONE_URL="https://%s@${CLONE_URL_BASE}" | ||
fi | ||
git clone --depth 1 --branch "${RELEASE_TAG}" "${CLONE_URL}" "${CLONE_DIR}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if we need to use GitHub actions, we don't need to clone, GitHub will clone the repository for us.
echo "Building gomobile and gobind from cloned tag ${RELEASE_TAG}..." | ||
( | ||
cd "${X_DIR_IN_CLONE}" | ||
go build -o "${MOBILEPROXY_BUILD_TOOLS_DIR}/gomobile" golang.org/x/mobile/cmd/gomobile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recently I was thinking whether we should always build the latest gomobile
, because it might introduce breaking changes. Shall we use a specific tag instead so prevent it from breaking our builds?
|
||
if [[ -n "${GH_TOKEN:-}" ]]; then | ||
echo "GH_TOKEN is set. Uploading artifacts to release tag ${RELEASE_TAG}..." | ||
gh release upload "${RELEASE_TAG}" "${IOS_ZIP_PATH}" "${ANDROID_AAR_PATH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Google doesn't allow us to put GitHub tokens in actions? So does that mean we will never be able to use it in actions?
|
||
jobs: | ||
release_mobileproxy: | ||
runs-on: ubuntu-latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we build xcframework on Ubuntu?
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any JDK or XCode required?
Co-authored-by: Vinicius Fortuna <[email protected]>
This pull request introduces a new script and workflow for automating the build and release process of the
mobileproxy
for iOS and Android. The script handles building artifacts, while the workflow integrates it into GitHub Actions for streamlined execution.New script for building and releasing
mobileproxy
:.github/scripts/release-mobileproxy.sh
, a Bash script that builds themobileproxy
for iOS and Android, zips the iOS framework, and optionally uploads the artifacts to a GitHub release. It supports environment variables and CLI arguments for configuration.GitHub Actions workflow for
mobileproxy
release:.github/workflows/release-mobileproxy.yml
, a workflow that triggers the release script via aworkflow_dispatch
event. It includes steps to set up Go, install the GitHub CLI, and execute the release script with the providedrelease_tag
.For a preview of how this will be used in the web wrapper: #446