Skip to content

Add curl and remove musl-dev from python build deps. #134

Add curl and remove musl-dev from python build deps.

Add curl and remove musl-dev from python build deps. #134

Workflow file for this run

# Build the docker images and push them to GitHub Packages
name: Publish Docker images
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
env:
REGISTRY: ghcr.io
REPO_PATH: ${{ github.repository }}
REPO_NAME: ${{ github.event.repository.name }}
BUILD_PLATFORMS: linux/amd64,linux/arm64
jobs:
check_changelog:
name: Check changelog versions
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Get current version
id: get-current-version
run: |
echo "current_version=$(grep -Po '(?<=## \[)(\d\.)+[^\]]' CHANGELOG.md | head -n 1)" >> "$GITHUB_OUTPUT"
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check already existing image
run: |
GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
TAGS_FULL=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}/tags/list)
TAGS_LITE=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}-lite/tags/list)
TAGS_LEGACY=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/${REPO_NAME,,}-legacy/tags/list)
TAGS_DEV_TOOLS=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${REPO_PATH,,}/ledger-app-dev-tools/tags/list)
ALL_TAGS_JSON_LIST=$(echo $TAGS_FULL $TAGS_LITE $TAGS_LEGACY $TAGS_DEV_TOOLS | jq -s add)
echo $ALL_TAGS_JSON_LIST
TAG_TO_FIND=${{ steps.get-current-version.outputs.current_version }}
# Find if TAG_TO_FIND is in TAGS (json)
RESULT=$(echo $TAGS | jq -r '.tags | map(select(. == "'${TAG_TO_FIND}'"))')
# Echo all tags
echo $TAGS
echo $RESULT
if [[ "${RESULT}" != "[]" ]]; then
echo "An image tagged with the latest changelog version already exists on GHCR. Please update the changelog."
exit 1
else
exit 0
fi
outputs:
current_version: ${{ steps.get-current-version.outputs.current_version }}
mods_list:
name: Get modified files
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changes
id: get-changes
uses: tj-actions/changed-files@v33
outputs:
modified_files: ${{ steps.get-changes.outputs.all_modified_files }}
builder_lite:
name: App Builder Lite
runs-on: ubuntu-latest
needs: [mods_list, check_changelog]
if: needs.check_changelog.result == 'success' && contains(needs.mods_list.outputs.modified_files, 'lite/Dockerfile')
permissions:
packages: write
steps:
- name: Clone
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make full image name
run: |
echo "IMAGE=${REGISTRY}/${REPO_PATH,,}/${REPO_NAME,,}-lite" >>${GITHUB_ENV}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE }}
- name: Set-up QEMU
uses: docker/setup-qemu-action@v2
- name: Set-up Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push container
uses: docker/build-push-action@v3
with:
file: lite/Dockerfile
platforms: ${{ env.BUILD_PLATFORMS }}
tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch' }}
builder_legacy:
name: App Builder Legacy
runs-on: ubuntu-latest
needs: [mods_list, check_changelog, builder_lite]
if: always() && needs.check_changelog.result == 'success' && (needs.builder_lite.result == 'success' || (needs.builder_lite.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'legacy/Dockerfile')))
permissions:
packages: write
steps:
- name: Clone
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make full image name
run: |
echo "IMAGE=${REGISTRY}/${REPO_PATH,,}/${REPO_NAME,,}-legacy" >>${GITHUB_ENV}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE }}
- name: Build and push container
uses: docker/build-push-action@v3
with:
file: legacy/Dockerfile
tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch' }}
builder:
name: App Builder
runs-on: ubuntu-latest
needs: [mods_list, check_changelog, builder_lite]
if: always() && needs.check_changelog.result == 'success' && (needs.builder_lite.result == 'success' || (needs.builder_lite.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'full/Dockerfile')))
permissions:
packages: write
steps:
- name: Clone
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make full image name
run: |
echo "IMAGE=${REGISTRY}/${REPO_PATH,,}/${REPO_NAME,,}" >>${GITHUB_ENV}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE }}
- name: Set-up QEMU
uses: docker/setup-qemu-action@v2
- name: Set-up Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push container
uses: docker/build-push-action@v3
with:
file: full/Dockerfile
platforms: ${{ env.BUILD_PLATFORMS }}
tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch' }}
dev_tools:
name: App Developer Tools
runs-on: ubuntu-latest
needs: [mods_list, check_changelog, builder]
if: always() && needs.check_changelog.result == 'success' && (needs.builder.result == 'success' || (needs.builder.result == 'skipped' && contains(needs.mods_list.outputs.modified_files, 'dev-tools/Dockerfile')))
permissions:
packages: write
steps:
- name: Clone
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Make full image name
run: |
echo "IMAGE=${REGISTRY}/${REPO_PATH,,}/ledger-app-dev-tools" >>${GITHUB_ENV}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE }}
- name: Set-up QEMU
uses: docker/setup-qemu-action@v2
- name: Set-up Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push container
uses: docker/build-push-action@v3
with:
file: dev-tools/Dockerfile
platforms: ${{ env.BUILD_PLATFORMS }}
tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ needs.check_changelog.outputs.current_version }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch' }}