Skip to content

Commit

Permalink
Merge pull request #37 from prezi/add-github-actions-workflows
Browse files Browse the repository at this point in the history
Add GitHub Actions workflows
  • Loading branch information
andraskalman-prezi authored Jan 8, 2024
2 parents 708a728 + ad7f651 commit c59a9f4
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create and publish a Docker image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # tag: v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c # tag: v5.5.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # tag: v5.1.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Run tests

on:
pull_request: {}
workflow_dispatch: {}

jobs:
run_linter:
name: Run linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Lint with Ruff
run: |
pip install ruff
ruff check --respect-gitignore --extend-select W,N --output-format=github .
2 changes: 1 addition & 1 deletion application.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from flask_restful import reqparse, Api, Resource
import sentry_sdk
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Table, Column, distinct, select
from sqlalchemy import Table, Column
from sqlalchemy.exc import IntegrityError
import settings
from sqlalchemy.orm import declarative_base
Expand Down
3 changes: 2 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

ALCHEMY_URL = 'sqlite:///changelog.db' #Any valid SQLAlchemy connection string.
LISTEN_HOST = "127.0.0.1"
LISTEN_PORT = 5000
Expand All @@ -7,7 +9,6 @@
SENTRY_DSN = None

# Loading site-specific override settings
import os
extra_settings_path = os.getenv('CHANGELOG_SETTINGS_PATH')
if extra_settings_path is not None:
try:
Expand Down

0 comments on commit c59a9f4

Please sign in to comment.