Skip to content

Commit f5af5fd

Browse files
committed
Add workflows to automate package publishing
1 parent 34f4992 commit f5af5fd

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

.github/RELEASE-TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Announcements
2+
* First announcement
3+
4+
# Changes

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: msgraph-sdk-python-core
4+
name: CI
55

66
on:
77
pull_request:

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish MsGraph-Core package to TestPyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
publish:
10+
name: Create release and publish distribution to TestPyPI
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.8
15+
with:
16+
python-version: 3.8
17+
- name: Install dependencies
18+
run: >-
19+
python -m pip install --upgrade pip
20+
python -m pip install flit
21+
- name: Publish distibution to TestPyPI
22+
if: github.repository == 'microsoftgraph/msgraph-sdk-python-core' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
23+
run: >-
24+
flit publish --repository https://test.pypi.org/legacy/ --username msgraphsdkteam --password ${{ secrets.TEST_PYPI_API_TOKEN }}

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Create a release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
autorelease:
10+
name: Create release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Set up Python 3.8
18+
- uses: actions/[email protected]
19+
with:
20+
python-version: 3.8
21+
- name: Release Notes
22+
run: git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
23+
- name: Create Release Draft
24+
uses: softprops/action-gh-release@v1
25+
with:
26+
body_path: ".github/RELEASE-TEMPLATE.md"
27+
draft: true
28+
files: |
29+
dist/msgraph_core-${{env.PROJECT_VERSION}}-py3-none-any.whl
30+
dist/msgraph_core-${{env.PROJECT_VERSION}}.tar.gz
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)