Skip to content

Commit e07a052

Browse files
Refactor into two workflows
1 parent d12d234 commit e07a052

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed

.github/workflows/release.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-22.04
11+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.8
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.8
20+
21+
- name: Compare tags
22+
run: |
23+
VERSION = `grep '__version__' mapbox_tilesets/__init__.py | sed -E "s/^.*['\"](.*)['\"].*$/\1/"`
24+
echo "Checking that package version [v$VERSION] matches release tag [${{ github.ref_name }}]"
25+
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$VERSION" ]
26+
27+
- name: Upgrade pip and setuptools
28+
run: |
29+
python -m pip install --upgrade pip setuptools
30+
31+
- name: Install dependencies
32+
run: pip install twine wheel
33+
34+
- name: Setup deployment
35+
run: python setup.py sdist bdist_wheel
36+
37+
- name: Validate deployment
38+
run: twine check dist/*
39+
40+
- name: Run deployment
41+
run:
42+
twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}
Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Unit test
22

33
on:
44
push:
@@ -45,38 +45,11 @@ jobs:
4545
- name: Run tests with coverage
4646
run: pytest --cov --cov-config=.coveragerc
4747

48+
- name: List all files in current directory
49+
run: ls -la
50+
4851
- name: Upload coverage to GitHub (optional, internal)
4952
uses: actions/upload-artifact@v4
5053
with:
5154
name: coverage-report
5255
path: .coverage
53-
54-
deploy:
55-
runs-on: ubuntu-22.04
56-
needs: test
57-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
58-
59-
steps:
60-
- uses: actions/checkout@v4
61-
62-
- name: Set up Python 3.8
63-
uses: actions/setup-python@v5
64-
with:
65-
python-version: 3.8
66-
67-
- name: Upgrade pip and setuptools
68-
run: |
69-
python -m pip install --upgrade pip setuptools
70-
71-
- name: Install dependencies
72-
run: pip install twine wheel
73-
74-
- name: Setup deployment
75-
run: python setup.py sdist bdist_wheel
76-
77-
- name: Validate deployment
78-
run: twine check dist/*
79-
80-
- name: Run deployment
81-
run:
82-
twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)