From d651379b5503abbd7f72b25943cecd4ea4e9bee5 Mon Sep 17 00:00:00 2001 From: barshaul Date: Sun, 18 Feb 2024 11:14:43 +0000 Subject: [PATCH] Removed unnecessary flags from the CD. --- .github/workflows/npm-cd.yml | 16 +++++----------- .github/workflows/pypi-cd.yml | 24 +++++++++--------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/npm-cd.yml b/.github/workflows/npm-cd.yml index 69d78aa85e..68dd3b3b82 100644 --- a/.github/workflows/npm-cd.yml +++ b/.github/workflows/npm-cd.yml @@ -12,6 +12,7 @@ on: - "v*.*" jobs: publish-binaries: + if: github.repository_owner == 'aws' name: Publish packages to NPM runs-on: ${{ matrix.build.RUNNER }} strategy: @@ -24,7 +25,6 @@ jobs: RUNNER: ubuntu-latest, ARCH: x64, TARGET: x86_64-unknown-linux-gnu, - NPM_PUBLISH: true, } - { OS: ubuntu-latest, @@ -32,7 +32,6 @@ jobs: RUNNER: [self-hosted, Linux, ARM64], ARCH: arm64, TARGET: aarch64-unknown-linux-gnu, - NPM_PUBLISH: true, CONTAINER: "2_28", } - { @@ -41,7 +40,6 @@ jobs: RUNNER: macos-latest, ARCH: x64, TARGET: x86_64-apple-darwin, - NPM_PUBLISH: true, } - { OS: macos-latest, @@ -49,7 +47,6 @@ jobs: RUNNER: macos-13-xlarge, arch: arm64, TARGET: aarch64-apple-darwin, - NPM_PUBLISH: true, } steps: - name: Checkout @@ -60,11 +57,10 @@ jobs: - name: Set the release version shell: bash run: | - export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi` - echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV + export version=`if ${{ github.event_name == 'pull_request' }}; then echo '255.255.255'; else echo ${GITHUB_REF:11}; fi` + echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV - name: Setup node - if: matrix.build.NPM_PUBLISH == true uses: actions/setup-node@v3 with: node-version: "16" @@ -81,7 +77,6 @@ jobs: named_os: ${{ matrix.build.NAMED_OS }} - name: Build Node wrapper - if: matrix.build.NPM_PUBLISH == true uses: ./.github/workflows/build-node-wrapper with: os: ${{ matrix.build.OS }} @@ -93,7 +88,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Publish to NPM - if: matrix.build.NPM_PUBLISH == true && github.event_name != 'pull_request' + if: github.event_name != 'pull_request' shell: bash working-directory: ./node run: | @@ -112,7 +107,6 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - name: Pack the Node package - if: matrix.build.NPM_PUBLISH == true shell: bash working-directory: ./node run: | @@ -126,7 +120,7 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - name: Upload the Node package - if: matrix.build.NPM_PUBLISH == true + if: github.event_name != 'pull_request' uses: actions/upload-artifact@v3 with: name: ${{ matrix.build.TARGET }} diff --git a/.github/workflows/pypi-cd.yml b/.github/workflows/pypi-cd.yml index cc273a3ede..003f2093b4 100644 --- a/.github/workflows/pypi-cd.yml +++ b/.github/workflows/pypi-cd.yml @@ -12,6 +12,7 @@ on: - "v*.*" jobs: publish-binaries: + if: github.repository_owner == 'aws' name: Publish packages to PyPi runs-on: ${{ matrix.build.RUNNER }} strategy: @@ -24,7 +25,6 @@ jobs: RUNNER: ubuntu-latest, ARCH: x64, TARGET: x86_64-unknown-linux-gnu, - PYPI_PUBLISH: true, } - { OS: ubuntu-latest, @@ -32,7 +32,6 @@ jobs: RUNNER: [self-hosted, Linux, ARM64], ARCH: arm64, TARGET: aarch64-unknown-linux-gnu, - PYPI_PUBLISH: true, CONTAINER: "2_28", } - { @@ -41,7 +40,6 @@ jobs: RUNNER: macos-latest, ARCH: x64, TARGET: x86_64-apple-darwin, - PYPI_PUBLISH: true, } - { OS: macos-latest, @@ -49,7 +47,6 @@ jobs: RUNNER: macos-13-xlarge, arch: arm64, TARGET: aarch64-apple-darwin, - PYPI_PUBLISH: true, } steps: - name: Checkout @@ -64,7 +61,6 @@ jobs: echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV - name: Set the package version for Python - if: matrix.build.PYPI_PUBLISH == true working-directory: ./python run: | SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi` @@ -73,18 +69,18 @@ jobs: cat Cargo.toml - name: Set up Python - if: matrix.build.PYPI_PUBLISH == true && !contains(matrix.build.RUNNER, 'self-hosted') + if: ${{ !contains(matrix.build.RUNNER, 'self-hosted') }} uses: actions/setup-python@v4 with: python-version: "3.10" - name: Set up Python older versions for MacOS - if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin') + if: startsWith(matrix.build.NAMED_OS, 'darwin') run: | brew install python@3.8 python@3.9 - name: Setup Python for self-hosted Ubuntu runners - if: matrix.build.PYPI_PUBLISH == true && contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted') + if: contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted') run: | sudo apt update -y sudo apt upgrade -y @@ -97,7 +93,6 @@ jobs: named_os: ${{ matrix.build.NAMED_OS }} - name: Build Python wrapper - if: matrix.build.PYPI_PUBLISH == true uses: ./.github/workflows/build-python-wrapper with: os: ${{ matrix.build.OS }} @@ -107,7 +102,6 @@ jobs: - name: Include protobuf files in the package working-directory: ./python - if: matrix.build.PYPI_PUBLISH == true run: | SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi` sed -i $SED_FOR_MACOS '/pb2.py/d' .gitignore @@ -115,12 +109,12 @@ jobs: cat .gitignore - name: Build Python wheels (linux) - if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux') && github.event_name != 'pull_request' + if: startsWith(matrix.build.NAMED_OS, 'linux') uses: PyO3/maturin-action@v1 with: working-directory: ./python target: ${{ matrix.build.TARGET }} - args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12 + args: --release --strip --out wheels -i ${{ github.event_name != 'pull_request' && 'python3.8 python3.9 python3.10 python3.11 python3.12' || 'python3.10' }} manylinux: auto container: ${{ matrix.build.CONTAINER != '' && matrix.build.CONTAINER || '2014' }} before-script-linux: | @@ -136,15 +130,15 @@ jobs: fi - name: Build Python wheels (macos) - if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin') && github.event_name != 'pull_request' + if: startsWith(matrix.build.NAMED_OS, 'darwin') uses: PyO3/maturin-action@v1 with: working-directory: ./python target: ${{ matrix.build.TARGET }} - args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12 + args: --release --strip --out wheels -i ${{ github.event_name != 'pull_request' && 'python3.8 python3.9 python3.10 python3.11 python3.12' || 'python3.10' }} - name: Upload Python wheels - if: matrix.build.PYPI_PUBLISH == true && github.event_name != 'pull_request' + if: github.event_name != 'pull_request' uses: actions/upload-artifact@v3 with: name: wheels