Skip to content

Commit

Permalink
Merge pull request #738 from microsoftgraph/shem/update_release_confi…
Browse files Browse the repository at this point in the history
…gurations_use_flint

Update release configuration -use flit for pulishing
  • Loading branch information
shemogumbe authored Jun 12, 2024
2 parents 12b2157 + 42cfcf0 commit f15da30
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ name: Build and validate generated code

on:
workflow_dispatch:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main, dev ]

permissions:
contents: read
workflow_call:

jobs:
validate:
Expand All @@ -27,3 +24,4 @@ jobs:
pip install -r requirements-dev.txt
- name: Lint with Pylint
run: pylint msgraph --disable=W --rcfile=.pylintrc

47 changes: 36 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,34 @@ permissions:
contents: write

jobs:
version:
name: Update version
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install poetry
run: |
pip install --upgrade poetry
- name: Update version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
poetry version $VERSION
- name: Commit changes
run: |
git config --local user.email "${{ secrets.GIT_USER_EMAIL }}"
git config --local user.name "${{ secrets.GIT_USER_NAME }}"
git commit -am "Update version"
git push origin ${{ github.ref }}
build:
needs: [version]
uses: ./.github/workflows/build.yml

publish:
Expand All @@ -24,18 +51,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
python-version: 3.12
- name: Install flit
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
pip install flit
- name: Publish the distibution to PyPI
run: flit publish
env:
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

release:
name: Create release
Expand Down

0 comments on commit f15da30

Please sign in to comment.