Skip to content

Commit 9c0f4b9

Browse files
authored
Merge pull request #1946 from pygame-community/ankith26-ci-release
Add GH actions infra to automate releases
2 parents 0de0937 + b6132f5 commit 9c0f4b9

File tree

7 files changed

+85
-61
lines changed

7 files changed

+85
-61
lines changed

.github/workflows/build-debian-multiarch.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
name: Debian Multiarch
66

7-
# Run CI only when a release is created, on changes to main branch, or any PR
8-
# to main. Do not run CI on any other branch. Also, skip any non-source changes
9-
# from running on CI
7+
# Run CI only on changes to main branch, or any PR to main. Do not run CI on
8+
# any other branch. Also, skip any non-source changes from running on CI
109
on:
11-
release:
12-
types: [created]
1310
push:
1411
branches: main
1512
paths-ignore:

.github/workflows/build-macos.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ name: MacOS
44
# to main. Do not run CI on any other branch. Also, skip any non-source changes
55
# from running on CI
66
on:
7-
release:
8-
types: [created]
97
push:
108
branches: main
119
paths-ignore:
@@ -29,6 +27,9 @@ on:
2927
- '.github/workflows/*.yml'
3028
# re-include current file to not be excluded
3129
- '!.github/workflows/build-macos.yml'
30+
31+
# the github release drafter can call this workflow
32+
workflow_call:
3233

3334
concurrency:
3435
group: ${{ github.workflow }}-${{ github.ref }}
@@ -171,19 +172,3 @@ jobs:
171172
name: pygame-wheels
172173
path: ./wheelhouse/*.whl
173174

174-
# - name: Upload binaries to Github Releases
175-
# if: github.event_name == 'release'
176-
# uses: svenstaro/upload-release-action@v2
177-
# with:
178-
# repo_token: ${{ secrets.GITHUB_TOKEN }}
179-
# file: ./wheelhouse/*.whl
180-
# tag: ${{ github.ref }}
181-
#
182-
# - name: Upload binaries to PyPI
183-
# if: github.event_name == 'release'
184-
# env:
185-
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
186-
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
187-
# run: |
188-
# python3 -m pip install twine
189-
# twine upload ./wheelhouse/*.whl

.github/workflows/build-manylinux.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ name: ManyLinux
44
# to main. Do not run CI on any other branch. Also, skip any non-source changes
55
# from running on CI
66
on:
7-
release:
8-
types: [created]
97
push:
108
branches: main
119
paths-ignore:
@@ -29,6 +27,9 @@ on:
2927
- '.github/workflows/*.yml'
3028
# re-include current file to not be excluded
3129
- '!.github/workflows/build-manylinux.yml'
30+
31+
# the github release drafter can call this workflow
32+
workflow_call:
3233

3334
concurrency:
3435
group: ${{ github.workflow }}-${{ github.ref }}
@@ -126,19 +127,3 @@ jobs:
126127
name: pygame-manylinux-wheels
127128
path: ./wheelhouse/*.whl
128129

129-
# - name: Upload binaries to Github Releases
130-
# if: github.event_name == 'release'
131-
# uses: svenstaro/upload-release-action@v2
132-
# with:
133-
# repo_token: ${{ secrets.GITHUB_TOKEN }}
134-
# file: ./wheelhouse/*.whl
135-
# tag: ${{ github.ref }}
136-
#
137-
# - name: Upload binaries to PyPI
138-
# if: github.event_name == 'release'
139-
# env:
140-
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
141-
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
142-
# run: |
143-
# python3 -m pip install twine
144-
# twine upload ./wheelhouse/*.whl

.github/workflows/build-ubuntu-sdist.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ name: Ubuntu sdist
1111
# to main. Do not run CI on any other branch. Also, skip any non-source changes
1212
# from running on CI
1313
on:
14-
release:
15-
types: [created]
1614
push:
1715
branches: main
1816
paths-ignore:
@@ -36,6 +34,9 @@ on:
3634
- '.github/workflows/*.yml'
3735
# re-include current file to not be excluded
3836
- '!.github/workflows/build-ubuntu-sdist.yml'
37+
38+
# the github release drafter can call this workflow
39+
workflow_call:
3940

4041
concurrency:
4142
group: ${{ github.workflow }}-${{ github.ref }}
@@ -90,19 +91,3 @@ jobs:
9091
name: pygame-sdist
9192
path: dist/*.tar.gz
9293

93-
# - name: Upload binaries to Github Releases
94-
# if: github.event_name == 'release' && matrix.os == 'ubuntu-20.04' # upload sdist only once
95-
# uses: svenstaro/upload-release-action@v2
96-
# with:
97-
# repo_token: ${{ secrets.GITHUB_TOKEN }}
98-
# file: dist/*.tar.gz
99-
# tag: ${{ github.ref }}
100-
#
101-
# - name: Upload binaries to PyPI
102-
# if: github.event_name == 'release' && matrix.os == 'ubuntu-20.04' # upload sdist only once
103-
# env:
104-
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
105-
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
106-
# run: |
107-
# python3 -m pip install twine
108-
# twine upload dist/*.tar.gz

.github/workflows/build-windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ name: Windows
44
# to main. Do not run CI on any other branch. Also, skip any non-source changes
55
# from running on CI
66
on:
7-
release:
8-
types: [created]
97
push:
108
branches: main
119
paths-ignore:
@@ -29,6 +27,9 @@ on:
2927
- '.github/workflows/*.yml'
3028
# re-include current file to not be excluded
3129
- '!.github/workflows/build-windows.yml'
30+
31+
# the github release drafter can call this workflow
32+
workflow_call:
3233

3334
concurrency:
3435
group: ${{ github.workflow }}-${{ github.ref }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Draft Github Release
2+
3+
on:
4+
push:
5+
branches: 'release/**'
6+
7+
jobs:
8+
manylinux:
9+
uses: ./.github/workflows/build-manylinux.yml
10+
11+
macos:
12+
uses: ./.github/workflows/build-macos.yml
13+
14+
windows:
15+
uses: ./.github/workflows/build-windows.yml
16+
17+
sdist:
18+
uses: ./.github/workflows/build-ubuntu-sdist.yml
19+
20+
draft-release:
21+
needs: [manylinux, macos, windows, sdist]
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/[email protected]
25+
26+
- name: Download all artifacts
27+
uses: actions/download-artifact@v3
28+
with:
29+
path: dist
30+
31+
# Strips 'release/' from the ref_name, this helps us access the version
32+
# name as 'steps.ver.outputs.VER'
33+
- name: Get version
34+
id: ver
35+
run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT
36+
37+
- name: Draft a release
38+
uses: softprops/action-gh-release@v1
39+
with:
40+
draft: true
41+
prerelease: ${{ contains(steps.ver.outputs.VER, 'dev') }}
42+
files: dist/*
43+
name: '${{ steps.ver.outputs.VER }} - {TODO put a title here} [DRAFTED BY CI]'
44+
tag_name: ${{ steps.ver.outputs.VER }}
45+
target_commitish: ${{ github.ref_name }}
46+
generate_release_notes: true

.github/workflows/release-pypi.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PyPI Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/[email protected]
12+
13+
- name: Pull all release assets
14+
uses: robinraju/[email protected]
15+
with:
16+
releaseId: ${{ github.event.release.id }}
17+
fileName: "*"
18+
tarBall: false
19+
zipBall: false
20+
out-file-path: "dist"
21+
22+
- name: Publish to PyPI
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)