Skip to content

Commit 8fd214b

Browse files
committed
Move to a more sane version (like nudge) and build 3.10.2 python
- This also makes changelog a bit more dynamic
1 parent 251cdfb commit 8fd214b

2 files changed

Lines changed: 75 additions & 70 deletions

File tree

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ env:
55
DEV_INSTALLER_ID: "Developer ID Installer: Clever DevOps Co. (9GQZ7KUFR6)"
66
DEV_APPLICATION_ID: "Developer ID Application: Clever DevOps Co. (9GQZ7KUFR6)"
77
NOTARY_PASS: ${{ secrets.NOTARY_PASS }}
8-
PYTHON_VERSION: "3.9.10"
8+
PYTHON_VERSION: "3.10.2"
99

1010
on:
1111
pull_request:
@@ -18,14 +18,10 @@ jobs:
1818
runs-on: macos-11.0
1919

2020
steps:
21-
- name: Set environment variables
22-
id: set_env_var
23-
run: |
24-
echo "BUILD_DATE=$(/bin/date -u "+%m%d%Y%H%M%S")" >> $GITHUB_ENV
25-
echo "BUILD_DATE_RELEASE=$(/bin/date -u "+%B %d %Y %H:%M:%S")" >> $GITHUB_ENV
26-
2721
- name: Checkout python repo
2822
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
2925

3026
- name: Install Apple Developer ID Application certificates
3127
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
@@ -45,84 +41,88 @@ jobs:
4541
- name: Run build package script
4642
run: ./build_python_framework_pkgs.zsh "$TYPE" "$DEV_INSTALLER_ID" "$DEV_APPLICATION_ID" "$PYTHON_VERSION" "${BUILD_DATE}" "${NOTARY_PASS}"
4743

44+
- name: get environment variables
45+
id: get_env_var
46+
run: |
47+
echo "PYTHON_BUILD_VERSION=$(/bin/cat ./build_info.txt)" >> $GITHUB_ENV
48+
49+
- name: Generate changelog
50+
id: changelog
51+
uses: metcalfc/changelog-generator@e5306b306fa2e34f05258789e0e5c526c1bd4352 # v1.0.0
52+
with:
53+
myToken: ${{ secrets.GITHUB_TOKEN }}
54+
4855
- name: Create Release
4956
if: github.ref == 'refs/heads/main'
5057
id: create_release
5158
uses: actions/create-release@v1
5259
env:
5360
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5461
with:
55-
tag_name: v.${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}
56-
release_name: Python ${{env.PYTHON_VERSION}} (${{env.BUILD_DATE_RELEASE}})
62+
tag_name: v${{env.PYTHON_BUILD_VERSION}}
63+
release_name: Python ${{env.PYTHON_BUILD_VERSION}}
5764
body: |
5865
# Notes
59-
Python 3.9.10 Framework
66+
Python ${{env.PYTHON_VERSION}} Framework
6067
6168
## Changes
62-
- Upgraded Python to 3.9.10
63-
**Note: Some of these updates have breaking changes. Always test your code before deploying to production!**
64-
- Updated the following libraries:
65-
- attrs to 21.4.0
66-
- black to 22.1.0
67-
- certifi to 2021.10.8
68-
- cffi to 1.15.0
69-
- cfgv to 3.3.1
70-
- chardet to 4.0.0
71-
- click to 8.0.3
72-
- distlib to 0.3.4
73-
- filelock to 3.4.2
74-
- flake8-bugbear to 22.1.11
75-
- flake8 to 4.0.1
76-
- identify to 2.4.7
77-
- idna to 3.3
78-
- importlib-metadata to 4.10.1
79-
- isort to 5.10.1
80-
- packaging to 21.3
81-
- pathspec to 0.9.0
82-
- pre-commit to 2.17.0
83-
- pycodestyle to 2.8.0
84-
- pycparser to 2.21
85-
- pyflakes to 2.4.0
86-
- pyobjc to 8.2
87-
- pyparsing to 3.0.7
88-
- PyYAML to 6.0
89-
- regex to 2022.1.18
90-
- requests to 2.27.1
91-
- tokenize-rt to 4.2.0
92-
- typed-ast to 1.5.2
93-
- urllib3 to 1.26.8
94-
- virtualenv to 20.13.0
95-
- xattr to 0.9.9
96-
- zipp to 3.7.0
69+
**Note: Some of these updates have breaking changes. Always test your code before deploying production!**
70+
- Library versions:
71+
- attrs 21.4.0
72+
- black 22.1.0
73+
- certifi 2021.10.8
74+
- cffi 1.15.0
75+
- cfgv 3.3.1
76+
- chardet 4.0.0
77+
- click 8.0.3
78+
- distlib 0.3.4
79+
- filelock 3.4.2
80+
- flake8-bugbear 22.1.11
81+
- flake8 4.0.1
82+
- identify 2.4.7
83+
- idna 3.3
84+
- importlib-metadata 4.10.1
85+
- isort 5.10.1
86+
- packaging 21.3
87+
- pathspec 0.9.0
88+
- pre-commit 2.17.0
89+
- pycodestyle 2.8.0
90+
- pycparser 2.21
91+
- pyflakes 2.4.0
92+
- pyobjc 8.2
93+
- pyparsing 3.0.7
94+
- PyYAML 6.0
95+
- regex 2022.1.18
96+
- requests 2.27.1
97+
- tokenize-rt 4.2.0
98+
- typed-ast 1.5.2
99+
- urllib3 1.26.8
100+
- virtualenv 20.13.0
101+
- xattr 0.9.9
102+
- zipp 3.7.0
103+
104+
${{ steps.changelog.outputs.changelog }}
97105
98106
# Flavors of Python
99107
At this time, the automated build process will **only** create the Recommended package
100108
101109
## Recommended
102110
This is a Python.framework that contains everything from minimal, and a few libraries that various well known open source projects require.
111+
112+
## Signing/Notarization
113+
The signed package is fully notarized, including the Python.framework file
103114
draft: false
104115
prerelease: true
105116

106-
- name: Upload Unsigned Package Release Asset
107-
if: github.ref == 'refs/heads/main'
108-
uses: actions/upload-release-asset@v1
109-
env:
110-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111-
with:
112-
upload_url: ${{ steps.create_release.outputs.upload_url }}
113-
asset_path: ./outputs/python_${{env.TYPE}}-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.pkg
114-
asset_name: python_${{env.TYPE}}-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.pkg
115-
asset_content_type: application/x-newton-compatible-pkg
116-
117117
- name: Upload Signed Package Release Asset
118118
if: github.ref == 'refs/heads/main'
119119
uses: actions/upload-release-asset@v1
120120
env:
121121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122122
with:
123123
upload_url: ${{ steps.create_release.outputs.upload_url }}
124-
asset_path: ./outputs/python_${{env.TYPE}}_signed-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.pkg
125-
asset_name: python_${{env.TYPE}}_signed-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.pkg
124+
asset_path: ./outputs/python_${{env.TYPE}}_signed-${{env.PYTHON_BUILD_VERSION}}.pkg
125+
asset_name: python_${{env.TYPE}}_signed-${{env.PYTHON_BUILD_VERSION}}.pkg
126126
asset_content_type: application/x-newton-compatible-pkg
127127

128128
- name: Upload Python Framework Release Asset
@@ -132,8 +132,8 @@ jobs:
132132
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133133
with:
134134
upload_url: ${{ steps.create_release.outputs.upload_url }}
135-
asset_path: ./outputs/Python3.framework_${{env.TYPE}}-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.zip
136-
asset_name: Python3.framework_${{env.TYPE}}-${{env.PYTHON_VERSION}}.${{env.BUILD_DATE}}.zip
135+
asset_path: ./outputs/Python3.framework_${{env.TYPE}}-${{env.PYTHON_BUILD_VERSION}}.zip
136+
asset_name: Python3.framework_${{env.TYPE}}-${{env.PYTHON_BUILD_VERSION}}.zip
137137
asset_content_type: application/zip
138138

139139
- name: Upload packages

build_python_framework_pkgs.zsh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PIPCACHEDIR="/Users/${CONSOLEUSER}/Library/Caches/pip"
2121
XCODE_PATH="/Applications/Xcode_13.2.1.app"
2222
XCODE_NOTARY_PATH="$XCODE_PATH/Contents/Developer/usr/bin/notarytool"
2323
XCODE_STAPLER_PATH="$XCODE_PATH/Contents/Developer/usr/bin/stapler"
24+
NEWSUBBUILD=$((80620 + $(git rev-parse HEAD~0 | xargs -I{} git rev-list --count {})))
2425

2526
# Sanity Checks
2627
## Type Check
@@ -54,10 +55,14 @@ fi
5455
if [ -n "$4" ]; then
5556
PYTHON_VERSION=$4
5657
else
57-
PYTHON_VERSION=3.9.10
58+
PYTHON_VERSION=3.10.2
5859
fi
5960
# Set python bin version based on PYTHON_VERSION
6061
PYTHON_BIN_VERSION="${PYTHON_VERSION%.*}"
62+
AUTOMATED_PYTHON_BUILD="$PYTHON_VERSION.$NEWSUBBUILD"
63+
64+
# Create files to use for build process info
65+
echo "$AUTOMATED_PYTHON_BUILD" > $TOOLSDIR/build_info.txt
6166

6267
if [ -n "$5" ]; then
6368
DATE=$5
@@ -224,15 +229,15 @@ fi
224229
"identifier": "org.macadmins.python.$TYPE",
225230
"postinstall_action": "none",
226231
"distribution_style": true,
227-
"version": "$PYTHON_VERSION.$DATE",
228-
"name": "python_$TYPE-$PYTHON_VERSION.$DATE.pkg",
232+
"version": "$AUTOMATED_PYTHON_BUILD",
233+
"name": "python_$TYPE-$AUTOMATED_PYTHON_BUILD.pkg",
229234
"install_location": "/"
230235
}
231236
JSONFILE
232237
# Create the unsigned pkg
233238
"${MP_BINDIR}/munki-pkg-${MP_SHA}/munkipkg" "$TOOLSDIR/$TYPE"
234239
# Move the unsigned pkg
235-
/bin/mv "$TOOLSDIR/$TYPE/build/python_$TYPE-$PYTHON_VERSION.$DATE.pkg" "$OUTPUTSDIR"
240+
/bin/mv "$TOOLSDIR/$TYPE/build/python_$TYPE-$AUTOMATED_PYTHON_BUILD.pkg" "$OUTPUTSDIR"
236241

237242
if [ -n "$2" ]; then
238243
# Create the json file for munki-pkg (signed)
@@ -243,8 +248,8 @@ if [ -n "$2" ]; then
243248
"identifier": "org.macadmins.python.$TYPE",
244249
"postinstall_action": "none",
245250
"distribution_style": true,
246-
"version": "$PYTHON_VERSION.$DATE",
247-
"name": "python_${TYPE}_signed-$PYTHON_VERSION.$DATE.pkg",
251+
"version": "$AUTOMATED_PYTHON_BUILD",
252+
"name": "python_${TYPE}_signed-$AUTOMATED_PYTHON_BUILD.pkg",
248253
"install_location": "/",
249254
"preserve_xattr": true,
250255
"signing_info": {
@@ -263,18 +268,18 @@ SIGNED_JSONFILE
263268
# Notarize and staple the package
264269
$XCODE_NOTARY_PATH store-credentials --apple-id "macadmins@cleverdevops.com" --team-id "9GQZ7KUFR6" --password "$NOTARY_PASS" macadminpython
265270
# If these fail, it will bail on the entire process
266-
$XCODE_NOTARY_PATH submit "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$PYTHON_VERSION.$DATE.pkg" --keychain-profile "macadminpython" --wait
267-
$XCODE_STAPLER_PATH staple "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$PYTHON_VERSION.$DATE.pkg"
271+
$XCODE_NOTARY_PATH submit "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$AUTOMATED_PYTHON_BUILD.pkg" --keychain-profile "macadminpython" --wait
272+
$XCODE_STAPLER_PATH staple "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$AUTOMATED_PYTHON_BUILD.pkg"
268273
fi
269274
# Move the signed + notarized pkg
270-
/bin/mv "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$PYTHON_VERSION.$DATE.pkg" "$OUTPUTSDIR"
275+
/bin/mv "$TOOLSDIR/$TYPE/build/python_${TYPE}_signed-$AUTOMATED_PYTHON_BUILD.pkg" "$OUTPUTSDIR"
271276
fi
272277
else
273278
echo "no signing identity passed, skipping signed package creation"
274279
fi
275280

276281
# Zip and move the framework
277-
ZIPFILE="Python3.framework_$TYPE-$PYTHON_VERSION.$DATE.zip"
282+
ZIPFILE="Python3.framework_$TYPE-$AUTOMATED_PYTHON_BUILD.zip"
278283
/usr/bin/ditto -c -k --sequesterRsrc "$TOOLSDIR/$TYPE/payload${FRAMEWORKDIR}/" ${ZIPFILE}
279284
/bin/mv ${ZIPFILE} "$OUTPUTSDIR"
280285

0 commit comments

Comments
 (0)