Skip to content

Commit

Permalink
add gha
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaffen committed Jul 11, 2023
1 parent 3782c73 commit 93ea7a0
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
60 changes: 60 additions & 0 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: Build container 🐳

on:
push:
branches:
- 'main'
tags:
- '*'

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get tags
shell: python
run: |
import re
import os
from packaging.version import parse
image = "ghcr.io/${{ github.repository }}"
tags = set()
version = "${{ github.ref_name }}"
if version.startswith('v'):
version = "${{ github.ref_name }}".replace("v", "")
tags.add(f"{image}:latest")
if version == 'main':
version = "development"
tags.add(f"{image}:{version}")
tags = ",".join(sorted(list(tags)))
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'tags={tags}', file=fh)
id: tags

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.tags }}
21 changes: 21 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: QA🚦

on:
pull_request:

jobs:
build_docker_image:
name: 'Test container build'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build container
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: false

0 comments on commit 93ea7a0

Please sign in to comment.