Skip to content

Commit

Permalink
[CI] Fix: split release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
grydz committed Apr 2, 2024
1 parent 125eca2 commit 02f7fb4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 26 deletions.
41 changes: 16 additions & 25 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,41 @@ name: CI

on: [push]

env:
PYTHON_SRC: "src"

permissions:
contents: read
id-token: write

jobs:
python:
name: Python CI (${{ matrix.os }})
uses: ./.github/workflows/python.yml
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
python-version: ${{ matrix.python-version }}
name: Python CI (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13]
target: [x86_64]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']

release:
needs: python
uses: ./.github/workflows/pypi_release.yml
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
python-version: ${{ matrix.python-version }}

release:
name: Release for Python ${{ matrix.python-version }} (${{ matrix.target }}-${{ matrix.os }})
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: python
package-version: ${{ needs.python.outputs.package-version }}
name: Release (${{ matrix.os }})
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, needs.python.outputs.package-version) }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13]
target: [x86_64]
python-version: ['3.8', '3.9', '3.10', '3.11']
environment:
name: release
url: https://pypi.org/p/intel-sgx-ra

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.target }}-wheels
path: dist

- name: Publish packages to PyPi
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }}
uses: pypa/gh-action-pypi-publish@release/v1
permissions:
contents: read
id-token: write
32 changes: 32 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release CI

on:
workflow_call:
inputs:
os:
required: true
type: string
target:
required: true
type: string
python-version:
required: true
type: string

jobs:
release:
name: Python ${{ inputs.python-version }} (${{ inputs.target }})
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/intel-sgx-ra

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.os }}-${{ inputs.python-version }}-${{ inputs.target }}-wheels
path: dist

- name: Publish packages to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 7 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
python-version:
required: true
type: string
outputs:
package-version:
description: "Version of the Python package"
value: ${{ jobs.build.outputs.package-version }}

env:
PYTHON_SRC: "src"
Expand All @@ -20,9 +24,11 @@ permissions:
contents: read

jobs:
python:
build:
name: Python ${{ inputs.python-version }} (${{ inputs.target }})
runs-on: ${{ inputs.os }}
outputs:
package-version: ${{ steps.metadata.outputs.PACKAGE_VERSION }}

steps:
- name: Checkout
Expand Down

0 comments on commit 02f7fb4

Please sign in to comment.