Skip to content

Commit ae6cb24

Browse files
committed
ci: cleanup release workflow
1 parent 0446783 commit ae6cb24

File tree

1 file changed

+31
-108
lines changed

1 file changed

+31
-108
lines changed

.github/workflows/release.yml

+31-108
Original file line numberDiff line numberDiff line change
@@ -6,125 +6,48 @@ on:
66
- '*.*.*'
77

88
jobs:
9-
10-
Linux:
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- uses: actions/checkout@v2
15-
- name: Get tag
16-
id: tag
17-
run: |
18-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v1
21-
with:
22-
python-version: 3.8
23-
- name: Install and set up Poetry
24-
run: |
25-
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
26-
python get-poetry.py --preview -y
27-
- name: Build distributions
28-
run: |
29-
source $HOME/.poetry/env
30-
poetry build -vvv
31-
- name: Upload distribution artifacts
32-
uses: actions/upload-artifact@v1
33-
with:
34-
name: pendulum-dist
35-
path: dist
36-
37-
MacOS:
38-
runs-on: macos-latest
39-
40-
steps:
41-
- uses: actions/checkout@v2
42-
- name: Get tag
43-
id: tag
44-
run: |
45-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
46-
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v1
48-
with:
49-
python-version: 3.8
50-
- name: Install and set up Poetry
51-
run: |
52-
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
53-
python get-poetry.py --preview -y
54-
- name: Build distributions
55-
run: |
56-
source $HOME/.poetry/env
57-
poetry build -vvv
58-
- name: Upload distribution artifacts
59-
uses: actions/upload-artifact@v1
60-
with:
61-
name: pendulum-dist
62-
path: dist
63-
64-
Windows:
65-
runs-on: windows-latest
66-
67-
steps:
68-
- uses: actions/checkout@v2
69-
- name: Get tag
70-
id: tag
71-
shell: bash
72-
run: |
73-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
74-
- name: Set up Python ${{ matrix.python-version }}
75-
uses: actions/setup-python@v1
76-
with:
77-
python-version: 3.8
78-
- name: Install and setup Poetry
79-
run: |
80-
Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py
81-
python get-poetry.py --preview -y
82-
- name: Build distributions
83-
run: |
84-
$env:Path += ";$env:Userprofile\.poetry\bin"
85-
poetry build -vvv
86-
- name: Upload distribution artifact
87-
uses: actions/upload-artifact@v1
88-
with:
89-
name: pendulum-dist
90-
path: dist
91-
929
Release:
93-
needs: [Linux, MacOS, Windows]
9410
runs-on: ubuntu-latest
9511

9612
steps:
9713
- name: Checkout code
9814
uses: actions/checkout@v2
15+
9916
- name: Get tag
10017
id: tag
101-
run: |
102-
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
103-
- name: Download distribution artifact
104-
uses: actions/download-artifact@master
18+
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
19+
20+
- name: Set up Python 3.9
21+
uses: actions/setup-python@v2
10522
with:
106-
name: pendulum-dist
107-
path: dist
108-
- name: Install and set up Poetry
109-
run: |
110-
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
111-
python get-poetry.py --preview -y
112-
- name: Check distributions
23+
python-version: "3.9"
24+
25+
- name: Install Poetry
11326
run: |
114-
ls -la dist
115-
- name: Publish to PyPI
116-
env:
117-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
27+
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
28+
| python - -y
29+
30+
- name: Update PATH
31+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
32+
33+
- name: Build project for distribution
34+
run: poetry build
35+
36+
- name: Check Version
37+
id: check-version
11838
run: |
119-
source $HOME/.poetry/env
120-
poetry publish
39+
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
40+
|| echo ::set-output name=prerelease::true
41+
12142
- name: Create Release
122-
id: create_release
123-
uses: actions/create-release@v1
124-
env:
125-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
43+
uses: ncipollo/release-action@v1
12644
with:
127-
tag_name: ${{ steps.tag.outputs.tag }}
128-
release_name: ${{ steps.tag.outputs.tag }}
45+
artifacts: "dist/*"
46+
token: ${{ secrets.GITHUB_TOKEN }}
12947
draft: false
130-
prerelease: false
48+
prerelease: steps.check-version.outputs.prerelease == 'true'
49+
50+
- name: Publish to PyPI
51+
env:
52+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
53+
run: poetry publish

0 commit comments

Comments
 (0)