From 7ea8069e4a8e61db51c071ee5234169c264c443f Mon Sep 17 00:00:00 2001 From: Jimmy Dee Date: Tue, 15 Jun 2021 09:28:00 -0700 Subject: [PATCH] initial commit --- .github/actions/import-release/action.yml | 55 +++++++++++++++++++++++ .github/workflows/import.yml | 41 +++++++++++++++++ README.md | 16 +++++++ 3 files changed, 112 insertions(+) create mode 100644 .github/actions/import-release/action.yml create mode 100644 .github/workflows/import.yml create mode 100644 README.md diff --git a/.github/actions/import-release/action.yml b/.github/actions/import-release/action.yml new file mode 100644 index 0000000..91bf91a --- /dev/null +++ b/.github/actions/import-release/action.yml @@ -0,0 +1,55 @@ +name: Import snapshot +description: Imports a snapshot of the main iOS repo +inputs: + tag: + required: true + description: A tag from the main iOS repo to import +outputs: + sha: + description: The sha for the generated commit in this repo + value: ${{ steps.import-code.outputs.sha }} + +runs: + using: composite + steps: + - name: Configure git + id: configure-git + shell: bash + run: | + git config user.name 'Branch SDK Team' + git config user.email sdk-team@branch.io + - name: Import code + id: import-code + shell: bash + run: | + # clear out the entire repo. * matches everything but .* + git rm -fr * + + # cannot git rm -fr .* because of ., .., .git, .ios-spm + # remove specific paths + [[ -d .swiftpm ]] && git rm -fr .swiftpm + [[ -f .cocoadocs ]] && git rm -f .cocoadocs + [[ -f .gitignore ]] && git rm -f .gitignore + + # Now copy in the entire iOS repo + cp -pR .ios-repo/* .ios-repo/.swift* .ios-repo/.cocoa* . + + # Scrub out any binaries from early commits + [[ -d carthage-files/output ]] && rm -fr carthage-files/output + + # Now ditch the local copy of the iOS repo + rm -fr .ios-repo + + # Undo any changes to README.md in this repo + # (the original is nearly blank anyway) + git reset HEAD README.md + git checkout -- README.md + + # Add everything again. This results in many unchanged files + # and only records what's changed since the last commit (release). + # This effectively squashes together all commits between releases. + git add . + git commit -a -m'[release] ${{ inputs.tag }}' + git push + + echo "::set-output name=sha::$(git rev-parse HEAD)" diff --git a/.github/workflows/import.yml b/.github/workflows/import.yml new file mode 100644 index 0000000..9bda872 --- /dev/null +++ b/.github/workflows/import.yml @@ -0,0 +1,41 @@ +name: Import release + +on: + workflow_dispatch: + inputs: + tag: + required: true + description: A release tag from the iOS repo to import + +jobs: + import: + runs-on: macos-latest + steps: + - name: Check out SPM repo + uses: actions/checkout@v2 + - name: Check out main iOS repo + uses: actions/checkout@v2 + with: + repository: BranchMetrics/ios-branch-deep-linking-attribution + ref: ${{ github.event.inputs.tag }} + path: .ios-repo + - name: Import release ${{ github.event.inputs.tag }} + id: import-release + uses: ./.github/actions/import-release + with: + tag: ${{ github.event.inputs.tag }} + - name: Create release + uses: actions/github-script@v4 + with: + result-encoding: string + script: | + const tag = '${{ github.event.inputs.tag }}'; + const sha = '${{ steps.import-release.outputs.sha }}'; + await github.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + target_commitish: sha, + tag_name: tag, + name: tag, + body: `Mirror of https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases/${tag}`, + }); diff --git a/README.md b/README.md new file mode 100644 index 0000000..9910a94 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Swift Package Manager repository for iOS + +_Work in progress_ + +This is a mirror of the main [iOS repository](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution) +for use only with Swift Package Manager. It removes binaries and all commit +history before release [0.35.0](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases/0.35.0), +the first release to support SPM. This greatly improves performance when using +SPM. Releases to the main repo are automatically replicated here with each +tag. + +This is for use only with Swift Package Manager. Please use the main repo for +any other purpose. + +See https://help.branch.io/developers-hub/docs/ios-sdk-overview for full +documentation of the Branch iOS SDK.