-
Notifications
You must be signed in to change notification settings - Fork 11
63 lines (59 loc) · 2.15 KB
/
import.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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,
});