Skip to content

Initial Commit

Initial Commit #14

Workflow file for this run

name: Build
on:
push:
jobs:
package:
name: Build API Docs
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Build
run: |
python -m pip install -r requirements.txt
make build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: output
path: ./output
docker:
name: Docker
runs-on: ubuntu-22.04
needs: [ package ]
env:
PUBLIC_IMAGE_PREFIX: 'datastewardshipwizard'
IMAGE_NAME: 'wizard-changelog'
DOCKER_META_CONTEXT: '.'
DOCKER_META_FILE: './Dockerfile'
DOCKER_META_PLATFORMS: 'linux/amd64,linux/arm64'
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Create output dir
run: |
mkdir output
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: output
path: ./output
- name: Check artifact
run: |
ls -lah ./output
# TEST DOCKER IMAGE BUILD
- name: Docker meta [test]
id: meta-test
uses: docker/metadata-action@v4
with:
images: |
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
- name: Docker build [test]
uses: docker/build-push-action@v4
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: false
tags: ${{ steps.meta-test.outputs.tags }}
labels: ${{ steps.meta-test.outputs.labels }}
# PREPARE
- name: Docker login [docker.io]
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
# DEVELOPMENT IMAGES
- name: Docker meta [dev]
id: meta-dev
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
- name: Docker build+push [dev]
uses: docker/build-push-action@v4
if: github.event_name != 'pull_request' && steps.meta-dev.outputs.tags != ''
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: true
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
# PUBLIC IMAGES
- name: Docker meta [public]
id: meta-public
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v4
with:
images: |
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Docker build+push [public]
uses: docker/build-push-action@v4
if: github.event_name != 'pull_request' && steps.meta-public.outputs.tags != ''
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: true
tags: ${{ steps.meta-public.outputs.tags }}
labels: ${{ steps.meta-public.outputs.labels }}