Skip to content

Commit

Permalink
Restrict openfl_container_image_workflow on approved branches (#1280)
Browse files Browse the repository at this point in the history
* Update openfl-docker-build.yml

* Update openfl-docker-build.yml

* Update openfl-docker-build.yml
  • Loading branch information
pasokan-intel authored Jan 17, 2025
1 parent 562c2e3 commit 2f4649e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/openfl-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:
default: 'latest'

env:
VERSION: ${{ github.ref == 'refs/heads/develop' && 'latest' || '1.7' }}
DEFAULT_VERSION: ${{
github.ref == 'refs/heads/develop' && 'latest' ||
github.ref == 'refs/heads/v1.7.x' && '1.7' ||
'fail' }}

permissions:
contents: read
Expand All @@ -24,6 +27,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Fail if invalid branch
if: env.DEFAULT_VERSION == 'fail'
run: |
echo "Invalid branch. The workflow only supports 'develop' or 'v1.7.x'."
exit 1
- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -36,6 +45,9 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine Image Tag
run: echo "IMAGE_TAG=${{ github.event.inputs.version || env.DEFAULT_VERSION }}" >> $GITHUB_ENV

- name: Build and Push OpenFL Base Image
uses: docker/build-push-action@v4
Expand All @@ -44,4 +56,4 @@ jobs:
file: openfl-docker/Dockerfile.base
push: true
tags: |
ghcr.io/${{ github.repository }}/openfl:${{ github.event.inputs.version || 'latest' }}
ghcr.io/${{ github.repository }}/openfl:${{ env.IMAGE_TAG }}

0 comments on commit 2f4649e

Please sign in to comment.