Skip to content

Release/0.2.2

Release/0.2.2 #47

Workflow file for this run

name: Release
on:
pull_request:
branches:
- main
types:
- closed
jobs:
tagging:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- name: Get the version
id: get_version
run: |
echo ::set-output name=TAG::`echo $SOURCE_VERSION | cut -d / -f 2`
env:
SOURCE_VERSION: ${{ github.event.pull_request.head.ref }}
- name: Echo tag
run: echo ${{ steps.get_version.outputs.TAG }}
- uses: actions/checkout@v2
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Masanori HIRANO"
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout main
git tag -a `echo '${{ github.event.pull_request.head.ref }}' | sed 's/release\///'` -m " "
git push origin `echo '${{ github.event.pull_request.head.ref }}' | sed 's/release\///'`
test:
# The type of runner that the job will run on
name: final test
runs-on: ${{ matrix.platform }}
needs: tagging
strategy:
max-parallel: 5
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
exclude:
- platform: windows-latest
python-version: 3.13
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install poetry
poetry install
- name: Test
run: |
poetry run black --check --diff --quiet .
poetry run isort --check --quiet .
poetry run pflake8 .
poetry run mypy .
poetry run pytest tests/
releasetest:
# The type of runner that the job will run on
name: release test
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install poetry
poetry install
- name: test release
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --build -r testpypi --username __token__ --password ${{ secrets.TEST_PYPI_TOKEN }}
releasetestcheck:
name: release test check
needs: releasetest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Get the version
id: get_version
run: |
echo ::set-output name=TAG::`echo $SOURCE_VERSION | cut -d / -f 2`
env:
SOURCE_VERSION: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Sleep for 300 seconds
run: sleep 300s
shell: bash
- name: Install test package
run: |
python -m pip install -f https://test.pypi.org/simple/pams/ pams==${{ steps.get_version.outputs.TAG }}
python -m pip install pytest
rm -r pams
rm pyproject.toml
- name: Test
run: |
pytest tests/
release:
name: release
needs: [releasetestcheck, tagging]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Get the version
id: get_version
run: |
echo ::set-output name=TAG::`echo $SOURCE_VERSION | cut -d / -f 2`
env:
SOURCE_VERSION: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install poetry
poetry install
- name: release
run: |
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.TAG }}
release_name: ${{ steps.get_version.outputs.TAG }}
draft: false
prerelease: false
body: |
${{ github.event.pull_request.body }}
This release is automatically generated.
Please see the pull request.
[${{ github.event.pull_request.html_url }}](${{ github.event.pull_request.html_url }})
- name: Generate checksum
run: |
cd dist; sha256sum * > checksums.txt; cd -
- name: Upload tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/pams-${{ steps.get_version.outputs.TAG }}.tar.gz
asset_name: pams-${{ steps.get_version.outputs.TAG }}.tar.gz
asset_content_type: application/gzip
- name: Upload whl
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/pams-${{ steps.get_version.outputs.TAG }}-py3-none-any.whl
asset_name: pams-${{ steps.get_version.outputs.TAG }}-py3-none-any.whl
asset_content_type: application/x-pywheel+zip
- name: Upload checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/checksums.txt
asset_name: pams-${{ steps.get_version.outputs.TAG }}-checksums.txt
asset_content_type: text/plain
- name: remove branch
run: |
git push --delete origin ${{ github.event.pull_request.head.ref }}