Skip to content

Commit

Permalink
Merge pull request #116 from DiamondLightSource/add-image-build-cron-job
Browse files Browse the repository at this point in the history
Add manual triggering to github action
  • Loading branch information
abigailalexander authored May 29, 2024
2 parents 4de1f5c + 3cf1338 commit 50876c1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Code CI
on:
push:
pull_request:
workflow_dispatch:
env:
# The target python version, which must match the Dockerfile version
CONTAINER_PYTHON: "3.10"
Expand Down Expand Up @@ -122,11 +123,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# image names must be all lower case
- name: Generate image repo name
run: echo IMAGE_REPOSITORY=ghcr.io/$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}") >> $GITHUB_ENV

# Fetch latest tag on this branch if manually triggered
- name: Fetch latest tag
if: github.event_name == 'workflow_dispatch'
run: echo "LATEST_TAG=git tag | sort --version-sort | tail -n1" >> $GITHUB_ENV

- name: Download wheel and lockfiles
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -173,10 +181,12 @@ jobs:
images: ${{ env.IMAGE_REPOSITORY }}
# Add the "edge" tag on all commits to the "integration" branch.
# Add the "latest" tag to repository tags only
# Add a version tag if workflow is manually triggered
tags: |
type=edge,branch=integration
type=ref,event=tag
type=raw,value=latest, enable=${{ github.ref_type == 'tag' }}
type=semver,pattern={{version}},value=${{ env.LATEST_TAG }},enable=${{github.event_name == 'workflow_dispatch'}}
- name: Push cached image to container registry
if: github.ref_type == 'tag' || github.ref_name == 'integration'
Expand Down

0 comments on commit 50876c1

Please sign in to comment.