Skip to content

Commit

Permalink
chore(cicd): Automate tagging process (#24)
Browse files Browse the repository at this point in the history
* chore(cicd): Automate tagging process

Signed-off-by: Chris Butler <chris.butler@redhat.com>

* chore(lint): formating

Signed-off-by: Chris Butler <chris.butler@redhat.com>

* chore(cicd): Correct workflow so that tag publishingonly happens on a branch push

Signed-off-by: Chris Butler <chris.butler@redhat.com>

* chore(cicd): workflow formatting

Signed-off-by: Chris Butler <chris.butler@redhat.com>

---------

Signed-off-by: Chris Butler <chris.butler@redhat.com>
  • Loading branch information
butler54 authored Nov 7, 2023
1 parent ab8dea3 commit d78a609
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
79 changes: 39 additions & 40 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,50 +74,49 @@ jobs:
run: |
pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure
# tag_version:
# needs: [pre-commit, tests, pre-commit-hook]
# if: github.ref == 'refs/heads/main' && github.repository == 'butler54/mdformat-frontmatter'
tag_github_publish:
needs: [pre-commit, tests, pre-commit-hook]
if: github.ref == 'refs/heads/main' && github.repository == 'butler54/mdformat-frontmatter'
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
# needs to be a GH admins
token: ${{ secrets.ADMIN_WRITE_PAT }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install python release tools
run: pip install python-semantic-release flit

- name: Release a new version to github
env:
GH_TOKEN: ${{ secrets.ADMIN_WRITE_PAT }}
run: |
git config --global user.name "semantic-release (via Github actions)"
git config --global user.email "semantic-release@github-actions"
semantic-release publish --verbosity=DEBUG
# publish:
# name: Publish to PyPi
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout source
# uses: actions/checkout@v3
# with:
# submodules: true
# fetch-depth: 0
# # needs to be a GH admins
# token: ${{ secrets.ADMIN_WRITE_PAT }}
# - name: Set up Python
# uses: actions/setup-python@v4
# - name: Set up Python 3.9
# uses: actions/setup-python@v1
# with:
# python-version: 3.9
# - name: Install python release tools
# run: pip install python-semantic-release flit

# - name: Release a new version to pypi
# env:
# PYPI_TOKEN: ${{ secrets.PYPI_KEY }}
# GH_TOKEN: ${{ secrets.ADMIN_WRITE_PAT }}
# - name: install flit
# run: |
# pip install flit~=3.0
# - name: Build and publish
# run: |
# git config --global user.name "semantic-release (via Github actions)"
# git config --global user.email "semantic-release@github-actions"
# semantic-release publish --verbosity=DEBUG
# # publish:
# # name: Publish to PyPi
# # if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# # runs-on: ubuntu-20.04
# # steps:
# # - name: Checkout source
# # uses: actions/checkout@v3
# # - name: Set up Python 3.9
# # uses: actions/setup-python@v1
# # with:
# # python-version: 3.9
# # - name: install flit
# # run: |
# # pip install flit~=3.0
# # - name: Build and publish
# # run: |
# # flit publish
# # env:
# # FLIT_USERNAME: __token__
# # FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
# flit publish
# env:
# FLIT_USERNAME: __token__
# FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ profile = "black"
version_variable = [
'mdformat_frontmatter/__init__.py:__version__'
]
build_command = 'flit build'
branch = 'main'
upload_to_pypi = false
version_source = 'commit'

0 comments on commit d78a609

Please sign in to comment.