-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (54 loc) · 1.6 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install python-semantic-release==8.1.1 poetry==1.8.2
poetry install
# 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 }}