Skip to content

Trigger Workflow

Trigger Workflow #35

Workflow file for this run

name: Import release
on:
workflow_dispatch:
inputs:
tag:
required: true
description: A release tag from the iOS repo to import
repository_dispatch:
jobs:
import:
runs-on: macos-latest
env:
MAIN_REPO_OWNER: BranchMetrics
MAIN_REPO_REPO: ios-branch-deep-linking-attribution
steps:
- name: Set tag name varibale for repository_dispatch event type
if: github.event_name == 'repository_dispatch'
run: |
echo IOS_SDK_REPO_TAG=${{ github.event.client_payload.tag }} >> $GITHUB_ENV
- name: Set tag name varibale for workflow_dispatch event type
if: github.event_name == 'workflow_dispatch'
run: |
echo IOS_SDK_REPO_TAG=${{ github.event.inputs.tag }} >> $GITHUB_ENV
- name: Check out SPM repo
uses: actions/checkout@v3
- name: Check out main iOS repo
uses: actions/checkout@v3
with:
repository: ${{ env.MAIN_REPO_OWNER }}/${{ env.MAIN_REPO_REPO }}
ref: ${{ env.IOS_SDK_REPO_TAG }}
path: .ios-repo
- name: Import release ${{ env.IOS_SDK_REPO_TAG }}
id: import-release
uses: ./.github/actions/import-release
with:
tag: ${{ env.IOS_SDK_REPO_TAG }}
- name: Create release
uses: actions/github-script@v4
with:
result-encoding: string
script: |
const tag = '${{ env.IOS_SDK_REPO_TAG }}';
const sha = '${{ steps.import-release.outputs.sha }}';
const mainRepoOwner = '${{ env.MAIN_REPO_OWNER }}';
const mainRepoRepo = '${{ env.MAIN_REPO_REPO }}';
const { data } = await github.repos.getReleaseByTag({
owner: mainRepoOwner,
repo: mainRepoRepo,
tag,
});
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/${mainRepoOwner}/${mainRepoRepo}/releases/${tag}`,
prerelease: data.prerelease,
});