Skip to content

Commit

Permalink
Merge pull request #1457 from yaptide/fluka-support
Browse files Browse the repository at this point in the history
Fluka support
  • Loading branch information
lequ0n authored Jan 6, 2024
2 parents 92e1eb2 + 56e0f23 commit e9c758e
Show file tree
Hide file tree
Showing 12 changed files with 369 additions and 185 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/cleanup_closed_pr_packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Cleanup GHCR docker packages on closed pull request

on:
pull_request_target:
types:
- closed

jobs:
cleanup-package:
name: Cleanup closed PR package
runs-on: ubuntu-latest
steps:
- name: Cleanup web package
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}-web
cut-off: now UTC
timestamp-to-use: created_at
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 0
filter-tags: pr-${{github.event.pull_request.number}}
token: ${{ secrets.PAT }}
51 changes: 51 additions & 0 deletions .github/workflows/deploy_master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy web docker image to GHCR registry on push to master

on:
push:
branches:
- master

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

jobs:
deploy-web:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.WORKER_IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
provenance: false
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}, ${{ steps.meta.outputs.tags }}-${{github.run_number}}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
DEPLOYMENT=dev
4 changes: 4 additions & 0 deletions .github/workflows/manual_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ jobs:
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Need to override the tag with pr-{issue_number} to make the retention working properly
tags: |
type=raw,value=pr-${{ github.event.issue.number }}
# see https://github.com/docker/build-push-action/issues/513#issuecomment-987951050
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
provenance: false
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/packages_retention.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Retention policy for web GHCR docker packages

on:
schedule:
- cron: '30 4 * * *' # Running everyday at 04:30 AM
workflow_dispatch:

jobs:
cleanup-packages:
name: Cleanup old GHCR docker packages
runs-on: ubuntu-latest
steps:
- name: Cleanup web outdated PR packages
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}-web
cut-off: 1 day ago UTC
timestamp-to-use: created_at
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 0
untagged-only: true
token: ${{ secrets.PAT }}
- name: Cleanup web latest but old PR packages
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}-web
cut-off: 3 days ago UTC
timestamp-to-use: created_at
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 0
filter-include-untagged: false
filter-tags: pr-*
token: ${{ secrets.PAT }}
- name: Cleanup web outdated master packages
uses: snok/container-retention-policy@v2
with:
image-names: ${{ github.event.repository.name }}-web
cut-off: 2 days ago UTC
timestamp-to-use: created_at
account-type: org
org-name: ${{ github.repository_owner }}
keep-at-least: 0
filter-include-untagged: false
filter-tags: master-*
skip-tags: master # Don't remove the newest master image
token: ${{ secrets.PAT }}
Loading

0 comments on commit e9c758e

Please sign in to comment.