Skip to content

Commit

Permalink
ci: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kamoo1 committed Mar 24, 2024
1 parent 6233988 commit 6e26a92
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches: ["main", "dev"]
pull_request:
branches: ["main", "dev"]

jobs:
tag-latest:
runs-on: ubuntu-latest
permissions:
contents: write
needs: semantic-release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
# if there were commits during previous steps
# actions/checkout#1327
# actions/checkout#461
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Run latest-tag
uses: EndBug/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

semantic-release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: pip
# to bypass protected branch rules:
# https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html#example-workflow (warnings section)
# https://github.com/python-semantic-release/python-semantic-release/issues/311
- name: semantic-release
run: |
python -m semantic_release version
python -m semantic_release publish
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

0 comments on commit 6e26a92

Please sign in to comment.