|
1 | 1 | name: Build package
|
2 | 2 | on:
|
| 3 | + pull_request: |
3 | 4 | push:
|
4 | 5 | branches:
|
5 | 6 | - main
|
6 | 7 | workflow_dispatch:
|
7 | 8 | permissions:
|
8 | 9 | contents: read
|
9 | 10 | id-token: write
|
| 11 | + |
10 | 12 | jobs:
|
11 |
| - macos: |
| 13 | + binary: |
12 | 14 | runs-on: macos-11
|
13 |
| - environment: aws |
14 | 15 | steps:
|
15 | 16 | - uses: actions/checkout@v3
|
| 17 | + |
16 | 18 | - name: Set up Python 3.10
|
17 | 19 | uses: actions/setup-python@v4
|
18 | 20 | with:
|
19 | 21 | python-version: "3.10"
|
20 |
| - - name: Set up Ruby 2.6 |
21 |
| - uses: actions/setup-ruby@v1 |
22 |
| - with: |
23 |
| - ruby-version: 2.6 |
24 |
| - - name: Set up certificates |
| 22 | + |
| 23 | + - name: Install app certificates |
25 | 24 | env:
|
26 | 25 | ITERATIVE_APPLICATION_CERT: ${{ secrets.ITERATIVE_APPLICATION_CERT }}
|
27 | 26 | ITERATIVE_APPLICATION_CERT_PASS: ${{ secrets.ITERATIVE_APPLICATION_CERT_PASS }}
|
28 |
| - ITERATIVE_INSTALLER_CERT: ${{ secrets.ITERATIVE_INSTALLER_CERT }} |
29 |
| - ITERATIVE_INSTALLER_CERT_PASS: ${{ secrets.ITERATIVE_INSTALLER_CERT_PASS }} |
30 | 27 | run: |
|
31 | 28 | echo $ITERATIVE_APPLICATION_CERT | base64 -d > application_cert.p12
|
32 |
| - echo $ITERATIVE_INSTALLER_CERT | base64 -d > installer_cert.p12 |
33 | 29 | security create-keychain -p 123456 build.keychain
|
| 30 | + # NOTE: signing and steps before it might take longer than default 300 seconds, so we extend the |
| 31 | + # timeout until the keychain automatically locks again. |
| 32 | + security set-keychain-settings -lut 3600 build.keychain |
34 | 33 | security default-keychain -s build.keychain
|
35 | 34 | security unlock-keychain -p 123456 build.keychain
|
36 | 35 | security import application_cert.p12 -k build.keychain -P $ITERATIVE_APPLICATION_CERT_PASS -T /usr/bin/codesign
|
37 |
| - security import installer_cert.p12 -k build.keychain -P $ITERATIVE_INSTALLER_CERT_PASS -T /usr/bin/productsign |
38 | 36 | security set-key-partition-list -S 'apple-tool:,apple:,codesign:,productsign:' -s -k 123456 build.keychain
|
39 | 37 | security find-identity -v
|
40 |
| - - name: Check signing |
41 |
| - run: | |
42 |
| - which codesign |
43 |
| - which productsign |
44 |
| - codesign -f -s 62687162A75C39558A9EA17B57E8C65306BABE92 upload.py |
| 38 | +
|
45 | 39 | - name: Install requirements
|
46 | 40 | run: |
|
47 | 41 | pip install wheel
|
48 | 42 | pip install -r requirements.txt
|
49 |
| - brew install mitchellh/gon/gon |
| 43 | +
|
50 | 44 | - name: Download dvc pkg
|
51 | 45 | run: python download.py
|
| 46 | + |
52 | 47 | - name: Install dvc requirements
|
53 | 48 | run: |
|
54 | 49 | # available lxml (webdav dependency) wheels are built with an old
|
55 | 50 | # SDK, which breaks osxpkg notarization. Building from scratch
|
56 | 51 | # instead.
|
57 | 52 | pip install ./dvc[all] --no-binary lxml
|
58 | 53 | pip install -r dvc/scripts/build-requirements.txt
|
| 54 | +
|
| 55 | + - name: Build binary |
| 56 | + run: | |
| 57 | + echo 'PKG = "osxpkg"' > dvc/dvc/utils/build.py |
| 58 | + python dvc/scripts/pyinstaller/build.py |
| 59 | + cp -a dvc/scripts/pyinstaller/dist dist |
| 60 | +
|
| 61 | + - name: Sign binary |
| 62 | + run: python sign_bin.py --application-id 62687162A75C39558A9EA17B57E8C65306BABE92 --keychain build.keychain |
| 63 | + |
| 64 | + - name: Create tar with binary files |
| 65 | + run: tar cvf dist.tar.gz dist |
| 66 | + |
| 67 | + - name: Upload binary to artifacts |
| 68 | + uses: actions/upload-artifact@v2 |
| 69 | + with: |
| 70 | + name: binary |
| 71 | + path: dist.tar.gz |
| 72 | + retention-days: 1 |
| 73 | + |
| 74 | + installer: |
| 75 | + needs: binary |
| 76 | + runs-on: macos-11 |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v3 |
| 79 | + |
| 80 | + - name: Set up Python 3.10 |
| 81 | + uses: actions/setup-python@v4 |
| 82 | + with: |
| 83 | + python-version: "3.10" |
| 84 | + |
| 85 | + - name: Set up Ruby 2.6 |
| 86 | + uses: actions/setup-ruby@v1 |
| 87 | + with: |
| 88 | + ruby-version: 2.6 |
| 89 | + |
| 90 | + - name: Install installer certificates |
| 91 | + env: |
| 92 | + ITERATIVE_INSTALLER_CERT: ${{ secrets.ITERATIVE_INSTALLER_CERT }} |
| 93 | + ITERATIVE_INSTALLER_CERT_PASS: ${{ secrets.ITERATIVE_INSTALLER_CERT_PASS }} |
| 94 | + run: | |
| 95 | + echo $ITERATIVE_INSTALLER_CERT | base64 -d > installer_cert.p12 |
| 96 | + security create-keychain -p 123456 build.keychain |
| 97 | + # NOTE: signing and steps before it might take longer than default 300 seconds, so we extend the |
| 98 | + # timeout until the keychain automatically locks again. |
| 99 | + security set-keychain-settings -lut 3600 build.keychain |
| 100 | + security default-keychain -s build.keychain |
| 101 | + security unlock-keychain -p 123456 build.keychain |
| 102 | + security import installer_cert.p12 -k build.keychain -P $ITERATIVE_INSTALLER_CERT_PASS -T /usr/bin/productsign |
| 103 | + security set-key-partition-list -S 'apple-tool:,apple:,codesign:,productsign:' -s -k 123456 build.keychain |
| 104 | +
|
| 105 | + - name: Check certificates |
| 106 | + run: security find-identity -v |
| 107 | + |
| 108 | + - name: Install requirements |
| 109 | + run: | |
| 110 | + pip install wheel |
| 111 | + pip install -r requirements.txt |
59 | 112 | gem install --no-document fpm
|
60 |
| - - name: Build and sign |
61 |
| - timeout-minutes: 120 |
| 113 | +
|
| 114 | + - name: Download signed binary |
| 115 | + uses: actions/download-artifact@v3 |
| 116 | + with: |
| 117 | + name: binary |
| 118 | + |
| 119 | + - name: Unpack tar with binary files |
| 120 | + run: tar -xvf dist.tar.gz |
| 121 | + |
| 122 | + - name: Build installer |
| 123 | + run: python build_installer.py |
| 124 | + |
| 125 | + - name: Sign installer |
| 126 | + run: python sign_installer.py --installer-id 374191642324A98B1D9835CCD256EDEE2C710051 --keychain build.keychain |
| 127 | + |
| 128 | + - name: Upload installer to artifacts |
| 129 | + uses: actions/upload-artifact@v2 |
| 130 | + with: |
| 131 | + name: installer |
| 132 | + path: dvc*.pkg |
| 133 | + retention-days: 1 |
| 134 | + |
| 135 | + notarize: |
| 136 | + needs: installer |
| 137 | + runs-on: macos-11 |
| 138 | + steps: |
| 139 | + - uses: actions/checkout@v3 |
| 140 | + |
| 141 | + - name: Set up Python 3.10 |
| 142 | + uses: actions/setup-python@v4 |
| 143 | + with: |
| 144 | + python-version: "3.10" |
| 145 | + |
| 146 | + - name: Install requirements |
| 147 | + run: | |
| 148 | + brew install mitchellh/gon/gon |
| 149 | +
|
| 150 | + - name: Download signed installer |
| 151 | + uses: actions/download-artifact@v3 |
| 152 | + with: |
| 153 | + name: installer |
| 154 | + |
| 155 | + - name: Notarize and staple installer |
62 | 156 | env:
|
63 | 157 | APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
64 |
| - run: | |
65 |
| - sed -i "" "s/timeout=180/timeout=7200/g" dvc/scripts/pyinstaller/sign.py |
66 |
| - python dvc/scripts/build.py osxpkg --sign-application --application-id 62687162A75C39558A9EA17B57E8C65306BABE92 --sign-installer --installer-id 374191642324A98B1D9835CCD256EDEE2C710051 --notarize --apple-id-username [email protected] --apple-id-password $APPLE_ID_PASSWORD |
| 158 | + run: python notarize_installer.py --apple-id-username [email protected] --apple-id-password $APPLE_ID_PASSWORD |
| 159 | + |
| 160 | + - name: Upload stapled installer to artifacts |
| 161 | + uses: actions/upload-artifact@v2 |
| 162 | + with: |
| 163 | + name: stapled_installer |
| 164 | + path: dvc*.pkg |
| 165 | + retention-days: 1 |
| 166 | + |
| 167 | + upload: |
| 168 | + needs: notarize |
| 169 | + runs-on: ubuntu-latest |
| 170 | + environment: aws |
| 171 | + steps: |
| 172 | + - uses: actions/checkout@v3 |
| 173 | + |
| 174 | + - name: Set up Python 3.10 |
| 175 | + uses: actions/setup-python@v4 |
| 176 | + with: |
| 177 | + python-version: "3.10" |
| 178 | + |
| 179 | + - name: Install requirements |
| 180 | + run: pip install awscli |
| 181 | + |
| 182 | + - name: Download signed, notarized and stapled installer |
| 183 | + uses: actions/download-artifact@v3 |
| 184 | + with: |
| 185 | + name: stapled_installer |
| 186 | + |
67 | 187 | - uses: aws-actions/configure-aws-credentials@v1
|
68 | 188 | with:
|
69 | 189 | aws-region: us-east-2
|
70 | 190 | role-to-assume: arn:aws:iam::260760892802:role/dvc-public-osxpkg-deployer
|
71 |
| - - name: Upload |
72 |
| - run: python upload.py dvc/scripts/fpm/dvc-*.pkg |
| 191 | + |
| 192 | + - name: Upload to aws |
| 193 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 194 | + run: python upload.py dvc-*.pkg |
0 commit comments