applovin-adapter-release #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update AppLovin Adapter (SPM) | |
| # Triggered by the "Release AppLovin Adapter" workflow in pubnative-hybid-ios-sdk-private | |
| # via repository_dispatch. Updates Package.resolved with the new hybid-ios-spm-sdk tag | |
| # SHA and the latest AppLovinMediationVerveCustomNetworkAdapter master HEAD, then opens a PR. | |
| on: | |
| repository_dispatch: | |
| types: [applovin-adapter-release] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| defaults: | |
| run: | |
| shell: bash -o pipefail {0} | |
| jobs: | |
| update: | |
| name: "Update Package.resolved and open PR" | |
| runs-on: ubuntu-latest | |
| env: | |
| HYBID_VERSION: ${{ github.event.client_payload.hybid_version }} | |
| ADAPTER_VERSION: ${{ github.event.client_payload.adapter_version }} | |
| SPM_COMMIT_SHA: ${{ github.event.client_payload.spm_commit_sha }} | |
| ADAPTER_SHA: ${{ github.event.client_payload.adapter_sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Update Package.resolved files | |
| run: | | |
| echo "Updating Package.resolved files:" | |
| echo " hybid-ios-spm-sdk → $HYBID_VERSION @ $SPM_COMMIT_SHA" | |
| echo " applovinmediationvervecustomnetworkadapter → master @ $ADAPTER_SHA" | |
| find . -name Package.resolved | sort | while read pkg; do | |
| echo " → $pkg" | |
| python3 -c "import json,os; d=json.load(open('$pkg')); [p.update({'state':{'revision':os.environ['SPM_COMMIT_SHA'],'version':os.environ['HYBID_VERSION']}}) for p in d['pins'] if p['identity']=='hybid-ios-spm-sdk']; [p.update({'state':{'branch':'master','revision':os.environ['ADAPTER_SHA']}}) for p in d['pins'] if p['identity']=='applovinmediationvervecustomnetworkadapter']; open('$pkg','w').write(json.dumps(d,indent=2))" | |
| done | |
| - name: Commit, push branch and open PR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| BRANCH="update-applovin-adapter-${ADAPTER_VERSION}" | |
| # Always reset branch to master — this branch belongs to automation | |
| git checkout -B "$BRANCH" | |
| git add -A | |
| # Skip if nothing changed vs master | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit — already up to date for v$ADAPTER_VERSION" | |
| exit 0 | |
| fi | |
| git commit -m "Pod AppLovinMediationVerveCustomNetworkAdapter v: $ADAPTER_VERSION is added" | |
| # Force push — overwrites any manual changes on this branch | |
| git push --force-with-lease origin "$BRANCH" 2>/dev/null \ | |
| || git push --force origin "$BRANCH" | |
| # Open PR only if one doesn't already exist | |
| if gh pr view "$BRANCH" --repo "$GITHUB_REPOSITORY" &>/dev/null; then | |
| echo "PR already exists for $BRANCH — skipping" | |
| else | |
| gh pr create \ | |
| --title "Pod AppLovinMediationVerveCustomNetworkAdapter v: $ADAPTER_VERSION is added" \ | |
| --body "Automated update: bumps AppLovin adapter to v$ADAPTER_VERSION (SPM)." \ | |
| --base master \ | |
| --head "$BRANCH" | |
| fi | |
| # Capture PR URL for Slack notification | |
| PR_URL=$(gh pr view "$BRANCH" --repo "$GITHUB_REPOSITORY" --json url --jq .url 2>/dev/null || echo "") | |
| echo "PR_URL=$PR_URL" >> "$GITHUB_ENV" | |
| echo "PR_OPENED=true" >> "$GITHUB_ENV" | |
| # ──────────────────────────────────────────────────────────────────────── | |
| # Slack notifications | |
| # ──────────────────────────────────────────────────────────────────────── | |
| - name: Slack success notification | |
| if: success() && env.PR_OPENED == 'true' | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| SLACK_IOS_RELEASES_CHANNEL: ${{ secrets.SLACK_IOS_RELEASES_CHANNEL }} | |
| STATUS: success | |
| DEMO_TITLE: "AppLovin Waterfall Demo" | |
| run: bash .github/scripts/notify-slack.sh | |
| - name: Slack failure notification | |
| if: failure() | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| SLACK_IOS_RELEASES_CHANNEL: ${{ secrets.SLACK_IOS_RELEASES_CHANNEL }} | |
| STATUS: failure | |
| DEMO_TITLE: "AppLovin Waterfall Demo" | |
| run: bash .github/scripts/notify-slack.sh |