forked from mac-cain13/R.swift
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (104 loc) · 4.12 KB
/
release.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
name: Release
on:
release:
types: created
env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer
jobs:
release-build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set version
run: |
sed -i "" "s/\(static let version = \"\).*\(\"\)/\1${TAG}\2/" Sources/rswift/Rswift.swift
env:
TAG: ${{ github.event.release.tag_name }}
- name: Tarball source
run: |
tar -zcvf $TARGET --exclude .git .
env:
TARGET: ${{ runner.temp }}/source.tar.gz
- name: Attach tarball to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/source.tar.gz
asset_name: rswift-${{ github.event.release.tag_name }}-source.tar.gz
asset_content_type: application/tar+gzip
- name: Build
run: swift build -v -c release
- name: Import Signing Certificates
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERTS }}
p12-password: ${{ secrets.APPLE_CERTS_PASSWORD }}
- name: Code Sign
run: |
codesign --force --options runtime --sign 'Developer ID Application: Mathijs Kadijk (5Z49PA849J)' .build/release/rswift
- name: Store build artifact
uses: actions/upload-artifact@v1
with:
name: rswift-${{ github.event.release.tag_name }}
path: .build/release/rswift
- name: Archive ZIP
run: zip --junk-paths ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip .build/release/rswift License
- name: Notarize ZIP
run: |
sh notarize.sh
env:
BUNDLE_ID: nl.mathijskadijk.rswift
DEV_ACCOUNT: ${{ secrets.APPLE_ID_EMAIL }}
PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
DEV_TEAM: 5Z49PA849J
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip
- name: Attach ZIP to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip
asset_name: rswift-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
- name: Publish to Cocoapods
run: |
export POD_VERSION=$(echo $TAG_NAME | cut -c2-)
pod trunk push
env:
TAG_NAME: ${{ github.event.release.tag_name }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
- name: Archive PKG
run: |
mkdir -p $PKG_ROOT/$BINARY_ROOT
cp .build/release/rswift $PKG_ROOT/$BINARY_ROOT
pkgbuild --root $PKG_ROOT --identifier "nl.mathijskadijk.rswift" --version $TAG_NAME --install-location "/" --sign "Developer ID Installer: Mathijs Kadijk (5Z49PA849J)" $FILENAME
env:
TAG_NAME: ${{ github.event.release.tag_name }}
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
BUNDLE_ID: nl.mathijskadijk.rswift
PKG_ROOT: ${{ runner.temp }}/pkgroot
BINARY_ROOT: /usr/local/bin
- name: Notarize PKG
run: |
sh notarize.sh && xcrun stapler staple "$FILENAME"
env:
BUNDLE_ID: nl.mathijskadijk.rswift
DEV_ACCOUNT: ${{ secrets.APPLE_ID_EMAIL }}
PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
DEV_TEAM: 5Z49PA849J
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
- name: Attach PKG to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
asset_name: rswift-${{ github.event.release.tag_name }}.pkg
asset_content_type: application/pkg
- name: Publish to Homebrew
run: brew bump-formula-pr --tag $TAG_NAME --revision $REVISION rswift || exit 0