Skip to content

Commit

Permalink
Add workflows to automate package publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelkanda committed Jul 14, 2021
1 parent 34f4992 commit f5af5fd
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/RELEASE-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Announcements
* First announcement

# Changes
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: msgraph-sdk-python-core
name: CI

on:
pull_request:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish MsGraph-Core package to TestPyPI

on:
release:
types:
- published

jobs:
publish:
name: Create release and publish distribution to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
with:
python-version: 3.8
- name: Install dependencies
run: >-
python -m pip install --upgrade pip
python -m pip install flit
- name: Publish distibution to TestPyPI
if: github.repository == 'microsoftgraph/msgraph-sdk-python-core' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: >-
flit publish --repository https://test.pypi.org/legacy/ --username msgraphsdkteam --password ${{ secrets.TEST_PYPI_API_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Create a release

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
autorelease:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
- uses: actions/checkout@v2.3.4
with:
python-version: 3.8
- name: Release Notes
run: git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
- name: Create Release Draft
uses: softprops/action-gh-release@v1
with:
body_path: ".github/RELEASE-TEMPLATE.md"
draft: true
files: |
dist/msgraph_core-${{env.PROJECT_VERSION}}-py3-none-any.whl
dist/msgraph_core-${{env.PROJECT_VERSION}}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f5af5fd

Please sign in to comment.