Skip to content

Add Fluka "simple example" #692

Add Fluka "simple example"

Add Fluka "simple example" #692

Workflow file for this run

name: On-demand deploy
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
issue_comment:
types: [created]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-web
jobs:
deploy:
runs-on: ubuntu-latest
# Only run if it is a PR and the comment contains /deploy
if: github.event.issue.pull_request && contains(github.event.comment.body, '/deploy')
# when we run this action as depenabot, we need to give it write permissions to the package registry and to the statuses
permissions:
contents: read
packages: write
statuses: write
pull-requests: write
steps:
- name: Get branch of PR
uses: xt0rted/pull-request-comment-branch@v3
id: comment-branch
- name: Set latest commit status as pending
uses: myrotvorets/[email protected]
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ steps.comment-branch.outputs.head_ref }}
- 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.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@v6
with:
provenance: false
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# it seems that cache is not giving any benefit in speed, lets keep it disabled for now
# cache-from: type=gha
# cache-to: type=gha,mode=max
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
DEPLOYMENT=dev
- name: Add workflow result as comment on PR
uses: actions/github-script@v7
if: always()
with:
script: |
const workflow_name = '${{ github.workflow }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const success = '${{ job.status }}' === 'success';
const body = `${workflow_name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/[email protected]
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}