Skip to content

Commit

Permalink
ci: add build and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
filipslezaklab committed Jun 12, 2023
1 parent fe42bf9 commit 94962a8
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- Semver-Major
- breaking-change
- title: Exciting New Features 🎉
labels:
- Semver-Minor
- enchancment
- title: Other Changes
labels:
- "*"
40 changes: 36 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v2
- run: pip install --upgrade pip
- run: pip install black
- run: black --check ./**/*.py
test:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install deps
Expand All @@ -34,3 +36,33 @@ jobs:
- run: poetry run python -m grpc_tools.protoc -Iproto --python_out=yubi-bridge --grpc_python_out=yubi-bridge proto/worker/worker.proto
- name: Run tests
run: poetry run pytest
build:
runs-on: self-hosterd
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/defguard/yubi-bridge
tags: |
type=raw,value=builder
type=ref,event=branch
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to github registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v3
with:
push: false
38 changes: 38 additions & 0 deletions .github/workflows/current.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build current image
on:
push:
branches:
- main

jobs:
publish:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/defguard/yubi-bridge
tags: |
type=raw,value=current
type=ref,event=branch
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to github registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release
on:
push:
tags:
- v*.*.*

jobs:
publish:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/defguard/yubi-bridge
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to github registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


release:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create release
uses: softprops/actions-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ __pycache__/
.vscode/
*_pb2.py
*_pb2_grpc.py
./*.local

0 comments on commit 94962a8

Please sign in to comment.