diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index dd4c48c..94dd684 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -1,5 +1,10 @@ name: Build and upload recommended package +env: + TYPE: "recommended" + DEV_ID: "Developer ID Installer: Clever DevOps Co. (9GQZ7KUFR6)" + PYTHON_VERSION: "3.8.3" + on: pull_request: push: @@ -11,6 +16,12 @@ jobs: runs-on: macos-latest steps: + - name: Get current time + uses: srfrnk/current-time@master + id: current-time + with: + format: MMDDYYYYHHmmss + - name: Checkout python repo uses: actions/checkout@v2 @@ -22,9 +33,56 @@ jobs: p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} - name: Run build package (recommended pkg) - run: /usr/bin/sudo ./build_python_framework_pkgs.zsh recommended "$DEV_ID" env: - DEV_ID: "Developer ID Installer: Clever DevOps Co. (9GQZ7KUFR6)" + TIME: "${{ steps.current-time.outputs.formattedTime }}" + run: /usr/bin/sudo ./build_python_framework_pkgs.zsh "$TYPE" "$DEV_ID" "$PYTHON_VERSION" "{TIME}" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: true + + - name: Upload Unsigned Package Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TIME: "${{ steps.current-time.outputs.formattedTime }}" + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./outputs/python_${{TYPE}}-${{PYTHON_VERSION}}.${{DATE}}.pkg + asset_name: python_${{TYPE}}-${{PYTHON_VERSION}}.${{DATE}}.pkg + asset_content_type: application/x-newton-compatible-pkg + + - name: Upload Signed Package Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TIME: "${{ steps.current-time.outputs.formattedTime }}" + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./outputs/python_${{TYPE}}_signed-${{PYTHON_VERSION}}.${{DATE}}.pkg + asset_name: python_${{TYPE}}_signed-${{PYTHON_VERSION}}.${{DATE}}.pkg + asset_content_type: application/x-newton-compatible-pkg + + - name: Upload Python Framework Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TIME: "${{ steps.current-time.outputs.formattedTime }}" + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./outputs/Python3.framework_${{TYPE}}-${{PYTHON_VERSION}}.${{DATE}}.zip + asset_name: Python3.framework_${{TYPE}}-${{PYTHON_VERSION}}.${{DATE}}.zip + asset_content_type: application/ application/zip - name: Upload packages uses: actions/upload-artifact@v1 diff --git a/build_python_framework_pkgs.zsh b/build_python_framework_pkgs.zsh index 7be5a63..06db509 100755 --- a/build_python_framework_pkgs.zsh +++ b/build_python_framework_pkgs.zsh @@ -6,7 +6,6 @@ # Run this with your current directory being the path where this script is located # Harcoded versions -PYTHON_VERSION=3.8.3 RP_SHA="8bce58e91895978da6f238c1d2e1de3559ea4643" MP_SHA="71c57fcfdf43692adcd41fa7305be08f66bae3e5" # Hardcoded paths @@ -54,8 +53,19 @@ if [[ $(/usr/bin/id -u) -ne 0 ]]; then exit 1 fi +if [ -n "$3" ]; then + PYTHON_VERSION=$3 +else + PYTHON_VERSION=3.8.3 +fi + +if [ -n "$4" ]; then + DATE=$4 +else + DATE=$(/bin/date -u "+%m%d%Y%H%M%S") +fi + # Variables -DATE=$(/bin/date -u "+%m%d%Y%H%M%S") TOOLSDIR=$(dirname $0) OUTPUTSDIR="$TOOLSDIR/outputs" CONSOLEUSER=$(/usr/bin/stat -f "%Su" /dev/console)