| 1 |
name: Release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
# release on tag push |
| 6 |
tags: |
| 7 |
- '*' |
| 8 |
|
| 9 |
jobs: |
| 10 |
packaging: |
| 11 |
|
| 12 |
runs-on: ${{ matrix.os }} |
| 13 |
defaults: |
| 14 |
run: |
| 15 |
shell: bash |
| 16 |
env: |
| 17 |
PYTHONIOENCODING: utf-8 |
| 18 |
strategy: |
| 19 |
fail-fast: false |
| 20 |
matrix: |
| 21 |
os: [ubuntu-20.04, macos-latest, windows-latest] |
| 22 |
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] |
| 23 |
|
| 24 |
steps: |
| 25 |
- name: Set git crlf/eol |
| 26 |
run: | |
| 27 |
git config --global core.autocrlf false |
| 28 |
git config --global core.eol lf |
| 29 |
|
| 30 |
- uses: actions/checkout@v3 |
| 31 |
with: |
| 32 |
fetch-depth: 0 |
| 33 |
|
| 34 |
- name: Set up Python ${{ matrix.python-version }} |
| 35 |
uses: actions/setup-python@v2 |
| 36 |
with: |
| 37 |
python-version: ${{ matrix.python-version }} |
| 38 |
|
| 39 |
- name: Install dependencies |
| 40 |
run: | |
| 41 |
python -m pip install --upgrade pip wheel |
| 42 |
pip install tox tox-gh-actions |
| 43 |
|
| 44 |
- name: Build dist pkgs |
| 45 |
run: | |
| 46 |
tox -e build |
| 47 |
|
| 48 |
- name: Upload artifacts |
| 49 |
if: matrix.python-version == 3.7 && runner.os == 'Linux' |
| 50 |
uses: actions/upload-artifact@v2 |
| 51 |
with: |
| 52 |
name: packages |
| 53 |
path: ./dist/pystache-* |
| 54 |
|
| 55 |
create_release: |
| 56 |
name: Create Release |
| 57 |
needs: [packaging] |
| 58 |
runs-on: ubuntu-20.04 |
| 59 |
|
| 60 |
steps: |
| 61 |
- name: Get version |
| 62 |
id: get_version |
| 63 |
run: | |
| 64 |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 65 |
echo ${{ env.VERSION }} |
| 66 |
|
| 67 |
- uses: actions/checkout@v3 |
| 68 |
with: |
| 69 |
fetch-depth: 0 |
| 70 |
|
| 71 |
# download all artifacts to project dir |
| 72 |
- uses: actions/download-artifact@v2 |
| 73 |
|
| 74 |
- name: Generate changes file |
| 75 |
uses: sarnold/gitchangelog-action@master |
| 76 |
with: |
| 77 |
github_token: ${{ secrets.GITHUB_TOKEN}} |
| 78 |
|
| 79 |
- name: Create release |
| 80 |
id: create_release |
| 81 |
uses: softprops/action-gh-release@v1 |
| 82 |
env: |
| 83 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 |
with: |
| 85 |
tag_name: ${{ env.VERSION }} |
| 86 |
name: Release ${{ env.VERSION }} |
| 87 |
body_path: CHANGES.md |
| 88 |
draft: false |
| 89 |
prerelease: false |
| 90 |
files: | |
| 91 |
packages/pystache-* |
| 92 |
|
| 93 |
# When a GitHub release is made, upload the artifacts to PyPI |
| 94 |
upload: |
| 95 |
name: Upload to PyPI |
| 96 |
runs-on: ubuntu-20.04 |
| 97 |
needs: [packaging] |
| 98 |
|
| 99 |
steps: |
| 100 |
- uses: actions/setup-python@v2 |
| 101 |
|
| 102 |
- uses: actions/download-artifact@v2 |
| 103 |
|
| 104 |
- name: check artifacts |
| 105 |
run: find . -maxdepth 2 -name pystache-\* -type f |
| 106 |
|
| 107 |
# - name: Publish bdist and sdist packages |
| 108 |
# uses: pypa/gh-action-pypi-publish@release/v1 |
| 109 |
# with: |
| 110 |
# password: ${{ secrets.PYPI_API_TOKEN }} |
| 111 |
# packages_dir: packages/ |
| 112 |
# print_hash: true |