77 branches: [main]
88
99jobs:
10- lint :
10+ build :
1111 runs-on: ubuntu-latest
1212 if: "!contains(github.event.head_commit.message, 'ci skip')"
1313 steps:
@@ -30,15 +30,51 @@ jobs:
3030 run: poetry run task lint
3131 - name: Run tests
3232 run: poetry run task test
33- - name: Release
34- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
35- run: |
36- pip install python-semantic-release
37- git config --global user.name "github-actions"
38- git config --global user.email "action@github.com"
39- poetry run task release
33+
34+ release:
35+ needs: build
36+ runs-on: ubuntu-latest
37+ if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'cd skip')
38+ steps:
39+ - uses: actions/checkout@v2
40+ - name: Bump version
41+ uses: TriPSs/conventional-changelog-action@v3
42+ id: version
43+ with:
44+ github-token: {% raw %} ${{ secrets.GITHUB_TOKEN }}{% endraw %}
45+ git-user-name: "GitHub Actions"
46+ git-user-email: "action@github.com"
47+ version-file: pyproject.toml
48+ version-path: tool.poetry.version
49+ preset: conventionalcommits
50+ output-file: false
51+ - name: Publish to GitHub
52+ if: steps.version.outputs.skipped == 'false'
53+ run: gh release create "$TAG" --notes "$BODY"
54+ env:
55+ GITHUB_TOKEN: {% raw %} ${{ secrets.GITHUB_TOKEN }}{% endraw %}
56+ TAG: {% raw %} ${{ steps.version.outputs.tag }}{% endraw %}
57+ BODY: {% raw %} ${{ steps.version.outputs.clean_changelog }}{% endraw %}
58+ {% if not private -%}
59+ - name: Publish to PyPI
60+ if: steps.version.outputs.skipped == 'false'
61+ run: pip install poetry && poetry publish --build
4062 env:
4163 GH_TOKEN: {% raw %} ${{ secrets.GITHUB_TOKEN }}{% endraw %}
42- {% if not private -%}
4364 PYPI_TOKEN: {% raw %} ${{ secrets.PYPI_TOKEN }}{% endraw %}
44- {% endif -%}
65+ {% endif -%}
66+ {% if docker -%}
67+ - uses: satackey/action-docker-layer-caching@v0.0.11
68+ if: steps.version.outputs.skipped == 'false'
69+ - name: Publish to DockerHub
70+ if: steps.version.outputs.skipped == 'false'
71+ run: |
72+ echo "$PASSWORD" | docker login https://ghcr.io -u "$USERNAME" --password-stdin
73+ docker build -t $REPO:$TAG -t $REPO:latest .
74+ docker push -a $REPO
75+ env:
76+ USERNAME: {% raw %} ${{ github.actor }}{% endraw %}
77+ PASSWORD: {% raw %} ${{ secrets.GITHUB_TOKEN }}{% endraw %}
78+ REPO: ghcr.io/{% raw %} ${{ github.repository }}{% endraw %}
79+ TAG: {% raw %} ${{ steps.version.outputs.tag }}{% endraw %}
80+ {% endif -%}
0 commit comments