Skip to content

Commit

Permalink
ci: cleanup release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 10, 2021
1 parent 87f53ee commit 7ce73e8
Showing 1 changed file with 31 additions and 108 deletions.
139 changes: 31 additions & 108 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,125 +6,48 @@ on:
- '*.*.*'

jobs:

Linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Get tag
id: tag
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install and set up Poetry
run: |
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py --preview -y
- name: Build distributions
run: |
source $HOME/.poetry/env
poetry build -vvv
- name: Upload distribution artifacts
uses: actions/upload-artifact@v1
with:
name: pendulum-dist
path: dist

MacOS:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Get tag
id: tag
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install and set up Poetry
run: |
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py --preview -y
- name: Build distributions
run: |
source $HOME/.poetry/env
poetry build -vvv
- name: Upload distribution artifacts
uses: actions/upload-artifact@v1
with:
name: pendulum-dist
path: dist

Windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Get tag
id: tag
shell: bash
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install and setup Poetry
run: |
Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py
python get-poetry.py --preview -y
- name: Build distributions
run: |
$env:Path += ";$env:Userprofile\.poetry\bin"
poetry build -vvv
- name: Upload distribution artifact
uses: actions/upload-artifact@v1
with:
name: pendulum-dist
path: dist

Release:
needs: [Linux, MacOS, Windows]
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get tag
id: tag
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Download distribution artifact
uses: actions/download-artifact@master
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
name: pendulum-dist
path: dist
- name: Install and set up Poetry
run: |
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py --preview -y
- name: Check distributions
python-version: "3.9"

- name: Install Poetry
run: |
ls -la dist
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build project for distribution
run: poetry build

- name: Check Version
id: check-version
run: |
source $HOME/.poetry/env
poetry publish
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
uses: ncipollo/release-action@v1
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: ${{ steps.tag.outputs.tag }}
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
prerelease: steps.check-version.outputs.prerelease == 'true'

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish

0 comments on commit 7ce73e8

Please sign in to comment.