Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic publish to PyPI workflow with automatic release note #34

Merged
merged 6 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
categories:
- title: ":boom: Breaking Changes"
label: "breaking"
- title: ":rocket: Features"
label: "enhancement"
- title: ":fire: Removals and Deprecations"
label: "removal"
- title: ":beetle: Fixes"
label: "bug"
Quentame marked this conversation as resolved.
Show resolved Hide resolved
- title: ":racehorse: Performance"
label: "performance"
- title: ":rotating_light: Testing"
label: "testing"
Quentame marked this conversation as resolved.
Show resolved Hide resolved
- title: ":construction_worker: Continuous Integration"
label: "ci"
- title: ":books: Documentation"
label: "documentation"
Quentame marked this conversation as resolved.
Show resolved Hide resolved
- title: ":hammer: Refactoring"
label: "refactoring"
Quentame marked this conversation as resolved.
Show resolved Hide resolved
- title: ":lipstick: Style"
label: "style"
- title: ":package: Dependencies"
labels:
- "dependencies"
Quentame marked this conversation as resolved.
Show resolved Hide resolved
- "build"
template: |
## Changes

$CHANGES
25 changes: 0 additions & 25 deletions .github/workflows/publish.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/[email protected]
with:
fetch-depth: 2

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.8"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version

- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"

- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/[email protected]
with:
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"

- name: Bump version for developmental release
oncleben31 marked this conversation as resolved.
Show resolved Hide resolved
if: "! steps.check-version.outputs.tag"
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
poetry version $version.dev.$(date +%s)

- name: Build package
run: |
poetry build --ansi

- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
oncleben31 marked this conversation as resolved.
Show resolved Hide resolved
uses: release-drafter/[email protected]
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion src/meteofrance/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
"""Météo-France API."""
__version__ = "0.1.1"
1 change: 0 additions & 1 deletion src/meteofrance/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""Consts for Météo-France weather forecast python API."""
# TODO: add package version
METEOFRANCE_API_URL = "http://webservice.meteofrance.com"
# Additionan API URL used with getDetail, getAllVigilances, getVigilance
METEOFRANCE_WS_API_URL = "http://ws.meteofrance.com/ws"
Expand Down