Skip to content

Commit

Permalink
add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
coddmeistr committed Jan 9, 2025
1 parent 6395c87 commit 7c62694
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Delete old container images

on:
schedule:
- cron: "0 0 * * *" # every day at midnight
workflow_dispatch:

jobs:
clean-ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cleanup Untagged Images (> 1 day)
uses: snok/container-retention-policy@v1
with:
image-names: support-pl/nocloud-driver-ovh
cut-off: A day ago UTC
account-type: org
org-name: Support-pl
untagged-only: true
token: ${{ secrets.PACKAGES_PAT }}
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Docker Image

on:
push:
branches:
- "master"
- "dev"
- "dev-*"
paths-ignore:
- "examples"
- "**/*.md"
- ".github/**"

env:
REGISTRY: ghcr.io
IMAGE_TAG: ${{github.ref_name == 'master' && 'latest' || github.ref_name}}

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

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
tags: type=raw,value=${{env.IMAGE_TAG}}
images: ${{ env.REGISTRY }}/support-pl/wireguard-agent

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 7c62694

Please sign in to comment.