Skip to content

Commit

Permalink
revert last commit. Extra tag for image if not on main
Browse files Browse the repository at this point in the history
  • Loading branch information
bquan0 committed Sep 19, 2024
1 parent e35ca4e commit 8c153cf
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ on:
- '.github/workflows/docker_publish.yml'
- 'environment.yml'

env:
EXTRA_TAG: ""
EXTRA_TAG_CI: ""

jobs:
build-dependency-img:
runs-on: ubuntu-latest

name: Install Dependencies

outputs:
image_tag: ${{ steps.output_tag.outputs.image_tag }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -28,21 +36,30 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add extra tag if NOT on the main branch
if: github.ref_name != 'main'
run: |
echo "EXTRA_TAG=-$github.ref_name" >> $GITHUB_ENV
echo "EXTRA_TAG_CI=:$github.ref_name" >> $GITHUB_ENV
- id: output_tag
run: echo "image_tag=$EXTRA_TAG_CI" >> $GITHUB_OUTPUT

- name: Build and push ParaStell Docker image
id: build-parastell
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/parastell:ci-layer-cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/parastell:ci-layer-cache,mode=max
cache-from: type=registry,ref=ghcr.io/svalinn/parastell:ci-layer-cache${{ env.EXTRA_TAG }}
cache-to: type=registry,ref=ghcr.io/svalinn/parastell:ci-layer-cache${{ env.EXTRA_TAG }},mode=max
file: Dockerfile
push: true
target: parastell-deps
tags: ghcr.io/${{ github.repository_owner }}/parastell-ci
tags: ghcr.io/svalinn/parastell-ci${{ env.EXTRA_TAG_CI }}

test-dependency-img:
needs: build-dependency-img
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository_owner }}/parastell-ci
container: ghcr.io/svalinn/parastell-ci${{ needs.build-dependency-img.outputs.image_tag }}

name: Test CI Image
steps:
Expand Down

0 comments on commit 8c153cf

Please sign in to comment.