Skip to content

Commit

Permalink
chore: config workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HADB committed Mar 13, 2024
1 parent 11a3804 commit 2dee45b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 8 deletions.
80 changes: 75 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,94 @@
name: Semantic Release
name: Release

on:
push:
branches:
- release
- main

jobs:
release:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

outputs:
released: ${{ steps.python-semantic-release.outputs.released }}
version: ${{ steps.python-semantic-release.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Python Semantic Release
id: python-semantic-release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

docker:
name: Docker Image
runs-on: ubuntu-latest
needs:
- bump-version
if: needs.bump-version.outputs.released == 'true'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Parse semantic version
id: parse-semver
run: |
full_version=`echo ${{ needs.bump-version.outputs.version }}`
major_version=`echo $full_version | cut -d'.' -f1`
minor_version=`echo $full_version | cut -d'.' -f2`
major_minor=`echo $major_version.$minor_version`
echo "MAJOR_VERSION=$major_version" >> $GITHUB_OUTPUT
echo "MAJOR_MINOR=$major_minor" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$full_version" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
font2svg/font2svg-api
ghcr.io/font2svg/font2svg-api
tags: |
${{ steps.parse-semver.outputs.FULL_VERSION }}
${{ steps.parse-semver.outputs.MAJOR_VERSION }}
${{ steps.parse-semver.outputs.MAJOR_MINOR }}
flavor: |
latest=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3-alpine

WORKDIR /app

COPY requirements.txt /app
RUN pip install --no-cache-dir --upgrade -r requirements.txt

COPY ./src /app

EXPOSE 80

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ line-length = 180

[tool.semantic_release]
assets = []
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
commit_message = "chore: release v{version}\n\nAutomatically generated by python-semantic-release"
commit_parser = "angular"
logging_use_named_masks = false
major_on_zero = true
Expand All @@ -21,7 +21,15 @@ prerelease = false
[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = []
exclude_commit_patterns = [
"^build: *",
"^chore: *",
"^ci: *",
"^docs: *",
"^refactor: *",
"^style: *",
"^test: *",
]

[tool.semantic_release.changelog.environment]
block_start_string = "{%"
Expand Down Expand Up @@ -50,8 +58,8 @@ allowed_tags = [
"feat",
"fix",
"perf",
"style",
"refactor",
"style",
"test",
]
minor_tags = ["feat"]
Expand Down

0 comments on commit 2dee45b

Please sign in to comment.