Skip to content

Commit

Permalink
Merge pull request #64 from lunakv/package-workflow
Browse files Browse the repository at this point in the history
Create container packaging pipeline
  • Loading branch information
lunakv authored Oct 1, 2023
2 parents 6842f43 + 1e8f504 commit 97c7c6a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 36 deletions.
12 changes: 0 additions & 12 deletions .github/actions/setup/action.yml

This file was deleted.

42 changes: 18 additions & 24 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
name: CI actions
on: [pull_request]
jobs:
install:
name: Install
ci:
name: Run CI validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
name: Setup

- name: Install Poetry
run: pipx install poetry==1.6.1
shell: bash

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

- name: Install dependencies
run: poetry install
lint:
needs: [install]
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
name: Setup

- name: Lint with flake8
run: poetry run flake8 . --count --statistics --show-source

- name: Check formatting with Black
run: poetry run black --check --diff .

- name: Check imports with isort
run: poetry run isort --check --diff .
- name: Lint with flake8
run: poetry run flake8 . --count --statistics --show-source
test:
needs: [install]
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Dummy test script
run: echo "OK"
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 97c7c6a

Please sign in to comment.