-
Notifications
You must be signed in to change notification settings - Fork 2
141 lines (122 loc) · 4.97 KB
/
create-releases.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Create releases
on:
workflow_dispatch:
inputs:
tags:
description: 'Tags (JSON)'
required: true
default: '[{ src: "release/1.0.0", dest: "v1.0.0" }]'
env:
upstream_repo_full_name: 'navermaps/NMapsMap'
git_config_user_name: 'github-actions'
git_config_user_email: '41898282+github-actions[bot]@users.noreply.github.com'
# TODO: Assertion 추가하기
jobs:
create-release:
name: Create a release ${{ matrix.tag.dest }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
tag: ${{ fromJson(github.event.inputs.tags) }}
if: ${{ github.event.inputs.tags != null }}
runs-on: macos-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
path: working_repo
- name: Checkout ${{ env.upstream_repo_full_name }} ${{ matrix.tag.src }}
uses: actions/checkout@v2
with:
repository: ${{ env.upstream_repo_full_name }}
ref: ${{ matrix.tag.src }}
path: upstream_repo
lfs: true
- name: Check architecture types in the binary
run: xcrun lipo upstream_repo/framework/NMapsMap.framework/NMapsMap -archs
- name: Create a thin binary for iphoneos
run: |
mkdir -p binaries/iphoneos
cp -a upstream_repo/framework/NMapsMap.framework binaries/iphoneos/NMapsMap.framework
xcrun lipo binaries/iphoneos/NMapsMap.framework/NMapsMap \
-output binaries/iphoneos/NMapsMap.framework/NMapsMap \
-extract arm64 \
-extract armv7
- name: Create a thin binary for iphonesimulator
run: |
mkdir -p binaries/iphonesimulator
cp -a upstream_repo/framework/NMapsMap.framework binaries/iphonesimulator/NMapsMap.framework
xcrun lipo binaries/iphonesimulator/NMapsMap.framework/NMapsMap \
-output binaries/iphonesimulator/NMapsMap.framework/NMapsMap \
-extract i386 \
-extract x86_64
- name: Create an XCFramework
working-directory: binaries
run: |
xcodebuild -create-xcframework \
-framework iphoneos/NMapsMap.framework \
-framework iphonesimulator/NMapsMap.framework \
-output NMapsMap.xcframework
- name: Create a ZIP archive
working-directory: binaries
run: zip -r -X NMapsMap.xcframework.zip NMapsMap.xcframework
- name: Estimate an asset URL
run: |
url=https://github.com/${{ github.repository }}/releases/download/${{ matrix.tag.dest }}/NMapsMap.xcframework.zip
echo "url=$url" >> $GITHUB_ENV
echo $url
- name: Compute a checksum from the ZIP archive
working-directory: working_repo
run: |
touch Package.swift
checksum=$(swift package compute-checksum ../binaries/NMapsMap.xcframework.zip)
echo "checksum=$checksum" >> $GITHUB_ENV
echo $checksum
- name: Generate Package.swift with URL and checksum
working-directory: working_repo
run: |
sed -e "s|<#url#>|${{ env.url }}|g" -e "s|<#checksum#>|${{ env.checksum }}|g" .Package.template.swift > Package.swift
cat Package.swift
- name: Setup Git configurations
working-directory: working_repo
run: |
git config user.name "${{ env.git_config_user_name }}"
git config user.email "${{ env.git_config_user_email }}"
- name: Show remotes in repository
working-directory: working_repo
run: git remote
- name: Add, commit and push to ${{ github.repository }}
working-directory: working_repo
# 태그를 미리 지정하지 않으면 create-release 액션이 이전 커밋에 태그를 지정하고 릴리즈하는 문제가 발생한다.
run: |
git add -A
git commit -m "Bump to ${{ matrix.tag.dest }}"
git tag ${{ matrix.tag.dest }}
git pull --rebase
git push origin HEAD
git push --tags origin HEAD
- name: Create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ matrix.tag.dest }}
- name: Upload a release asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: binaries/NMapsMap.xcframework.zip
asset_name: NMapsMap.xcframework.zip
asset_content_type: application/zip
- name: Check asset URLs
run: |
echo "${{ env.url }}"
echo "${{ steps.upload_release_asset.outputs.browser_download_url }}"
- name: List all files in working directory
run: find .