Skip to content

Commit d3b5a81

Browse files
authored
Merge pull request hamcrest#212 from offbyone/release-by-ci
Add a release workflow based on tags
2 parents 7d8615e + e04650b commit d3b5a81

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- V*
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
jobs:
14+
pure-python-wheel-and-sdist:
15+
name: Build a pure Python wheel and source distribution
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
# Fetch all tags
22+
fetch-depth: 0
23+
24+
- name: Install build dependencies
25+
run: python -m pip install --upgrade build
26+
27+
- name: Build
28+
run: python -m build
29+
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: artifacts
33+
path: dist/*
34+
if-no-files-found: error
35+
36+
publish:
37+
name: Publish release
38+
needs:
39+
- pure-python-wheel-and-sdist
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
42+
43+
steps:
44+
- uses: actions/download-artifact@v2
45+
with:
46+
name: artifacts
47+
path: dist
48+
49+
- name: Push build artifacts to PyPI
50+
uses: pypa/[email protected]
51+
with:
52+
skip_existing: true
53+
user: __token__
54+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
55+
repository_url: "https://test.pypi.org/legacy/"

0 commit comments

Comments
 (0)