fix github.ref_name syntax #76
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & publish Docker image for ParaStell CI | |
on: | |
# allows us to run workflows manually | |
workflow_dispatch: | |
push: | |
paths: | |
- 'Dockerfile' | |
- '.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 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
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/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/svalinn/parastell-ci${{ env.EXTRA_TAG_CI }} | |
test-dependency-img: | |
needs: build-dependency-img | |
runs-on: ubuntu-latest | |
container: ghcr.io/svalinn/parastell-ci${{ needs.build-dependency-img.outputs.image_tag }} | |
name: Test CI Image | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Populate environment and run tests | |
run: | | |
. /opt/etc/bashrc | |
sed -e "s/@SERVER@/${rlmSERVER}/" -e "s/@PASSWORD@/${rlmPASSWD}/" /opt/Coreform-Cubit-2023.11/bin/licenses/rlmcloud.in > /opt/Coreform-Cubit-2023.11/bin/licenses/rlmcloud.lic | |
export PYTHONPATH=${PYTHONPATH}:`pwd` | |
cd tests | |
pytest -v . | |
env: | |
rlmSERVER: ${{ secrets.RLMSERVER }} | |
rlmPASSWD: ${{ secrets.RLMPASSWORD }} |