build: semantic-release sets library version everywhere (#16) #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# This file is part of py-serializable | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# Copyright (c) Paul Horton. All Rights Reserved. | |
name: Release | |
on: | |
push: | |
branches: [ 'main' ] | |
workflow_dispatch: | |
concurrency: | |
group: release | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION_DEFAULT: "3.11" | |
POETRY_VERSION: "1.4.1" | |
jobs: | |
release: | |
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482 | |
# limit this to being run on regular commits, not the commits that semantic-release will create | |
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
# see https://github.com/actions/checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python Environment | |
# see https://github.com/actions/setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_DEFAULT }} | |
architecture: 'x64' | |
- name: Install poetry | |
# see https://github.com/marketplace/actions/setup-poetry | |
uses: Gr1N/setup-poetry@v8 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install dependencies | |
run: poetry install --no-root | |
- name: View poetry version | |
run: poetry --version | |
- name: Python Semantic Release | |
# see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html | |
# see https://github.com/python-semantic-release/python-semantic-release | |
uses: python-semantic-release/python-semantic-release@v7.34.6 | |
with: | |
github_token: ${{ secrets.GH_RELEASE_TOKEN }} | |
repository_username: __token__ | |
repository_password: ${{ secrets.PYPI_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_TOKEN }} |