Skip to content

Merge pull request #47 from brianmajor/main #38

Merge pull request #47 from brianmajor/main

Merge pull request #47 from brianmajor/main #38

Workflow file for this run

name: Continous Deployment
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
releaseer:
runs-on: ubuntu-latest
steps:
-
name: Create release
id: release-please
uses: google-github-actions/release-please-action@v3
with:
release-type: python
package-name: science-containers
-
name: Print Release Info
if: ${{ steps.release-please.outputs.release_created }}
shell: bash
run: |
echo "Release Version: ${{ steps.release-please.outputs.tag_name }}"
outputs:
release_created: ${{ steps.release-please.outputs.releases_created }}
releases: ${{ steps.release-please.outputs.releases }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
builder:
runs-on: ubuntu-latest
needs: releaseer
if : ${{ needs.releaseer.outputs.release_created }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
-
name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 1
-
name: Create Release Metadata
id: metadata
run: |
echo "Creating Release Metadata"
echo "Release Tag: ${{ needs.releaseer.outputs.tag_name }}"
REGISTRY="images.canfar.net/"
echo REGISTRY=${REGISTRY} >> $GITHUB_OUTPUT
IMAGE="canfar/base"
echo IMAGE=${IMAGE} >> $GITHUB_OUTPUT
FLAVOR=${{ matrix.python-version }}
echo FLAVOR=${FLAVOR} >> $GITHUB_OUTPUT
TAG=${{ needs.releaseer.outputs.tag_name }}
echo TAG=${TAG} >> $GITHUB_OUTPUT
echo IMAGE_LATEST=${REGISTRY}${IMAGE}-${FLAVOR}:latest >> $GITHUB_OUTPUT
echo IMAGE_TAGGED=${REGISTRY}${IMAGE}-${FLAVOR}:${TAG} >> $GITHUB_OUTPUT
-
name: Setup Docker Buildx Environment
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
-
name: Perform CANFAR Harbor Login
uses: docker/login-action@v1
with:
registry: images.canfar.net
username: ${{ secrets.HARBOR_CANFAR_USERNAME }}
password: ${{ secrets.HARBOR_CANFAR_PASSWORD }}
-
name: Build & Push Production Image
uses: docker/build-push-action@v3
id: build-push-production
with:
context: science-containers/images/base
file: science-containers/images/base/Dockerfile
platforms: linux/amd64
build-args:
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
${{ steps.metadata.outputs.IMAGE_LATEST }}
${{ steps.metadata.outputs.IMAGE_TAGGED }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max