Skip to content

Xdmod Application Information Document (AID) #113

Xdmod Application Information Document (AID)

Xdmod Application Information Document (AID) #113

Workflow file for this run

name: Build
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-moc-xdmod:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata for moc-xdmod
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-moc-xdmod
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push moc-xdmod Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.moc-xdmod
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata for moc-xdmod-dev
id: meta-dev
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-moc-xdmod-dev
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
# Update the moc-xdmod-dev Dockerfile so that it's based on the
# moc-xdmod image we just built. This also ensures that the
# repository name is lower case (otherwise Docker will reject
# the FROM line).
- name: Pin to moc-xdmod image
run: |
commit_sha=${{ github.sha }}
commit_sha_short=${commit_sha:0:7}
sed "/^FROM/ s|moc-xdmod|\\L${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-moc-xdmod:sha-${commit_sha_short}|" \
Dockerfile.moc-xdmod-dev > Dockerfile.moc-xdmod-dev.CI
cat Dockerfile.moc-xdmod-dev.CI
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push moc-xdmod-dev Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.moc-xdmod-dev.CI
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
build-xdmod-openstack:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata for xdmod-openstack
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-xdmod-openstack
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push xdmod-openstack Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.xdmod-openstack
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}