Skip to content

feat: add multi-arch support, git tag versioning, and pipeline monito… #45

feat: add multi-arch support, git tag versioning, and pipeline monito…

feat: add multi-arch support, git tag versioning, and pipeline monito… #45

Workflow file for this run

name: build
on:
push:
branches:
- '*'
tags:
- '*'
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: docker.io
ORGANISATION_NAME: aemdesign
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: set envirnment variables
id: config
run: |
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_config.sh)
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_version.sh)
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
load: true
tags: |
${{ env.IMAGE }}:${{ env.GIT_BRANCH }}
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE }}:${{ env.GIT_BRANCH }}
# - name: test docker image
# run: |
# cd test && bash ./run_tests.sh "$IMAGE:$GIT_BRANCH"
- name: Run docker image analysis
continue-on-error: true
uses: MaxymVlasov/dive-action@v1.4.0
with:
image: ${{ steps.docker_build.outputs.imageid }}
config-file: ${{ github.workspace }}/.dive-ci.yml
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate tags
id: tags
run: |
# Check if this is a tag push
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
# Extract tag name (e.g., refs/tags/2.0.187 -> 2.0.187)
VERSION_TAG="${{ github.ref_name }}"
TAGS="${IMAGE}:${VERSION_TAG}"
TAGS="${TAGS},ghcr.io/${GITHUB_REPOSITORY_OWNER}/${IMAGE}:${VERSION_TAG}"
echo "Building from git tag: ${VERSION_TAG}"
else
# Branch push - use branch name
TAGS="${IMAGE}:${GIT_BRANCH}"
TAGS="${TAGS},ghcr.io/${GITHUB_REPOSITORY_OWNER}/${IMAGE}:${GIT_BRANCH}"
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
TAGS="${TAGS},${IMAGE}:latest"
TAGS="${TAGS},ghcr.io/${GITHUB_REPOSITORY_OWNER}/${IMAGE}:latest"
fi
echo "Building from branch: ${GIT_BRANCH}"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "Generated tags: ${TAGS}"
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v2
continue-on-error: true
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: aemdesign/java-ffmpeg
- uses: meeDamian/github-release@1.0
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ env.GIT_RELEASE_NOTES }}