|
|
|
@ -13,15 +13,19 @@ on:
|
|
|
|
|
- 'mix/**'
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
|
REGISTRY_GHCR: ghcr.io
|
|
|
|
|
REGISTRY_LOCAL: localhost:5000
|
|
|
|
|
MIX_IMAGE_NAME: ${{ github.repository_owner }}/mix
|
|
|
|
|
ECS_IMAGE_NAME: ${{ github.repository_owner }}/ecs
|
|
|
|
|
REGISTRY_DOCKER: docker.io
|
|
|
|
|
MIX_IMAGENAME_GHCR: ${{ github.repository_owner }}/mix
|
|
|
|
|
ECS_IMAGENAME_GHCR: ${{ github.repository_owner }}/ecs
|
|
|
|
|
MIX_IMAGENAME_DOCKERHUB: ${{ secrets.DOCKERHUB_USERNAME }}/mix
|
|
|
|
|
ECS_IMAGENAME_DOCKERHUB: ${{ secrets.DOCKERHUB_USERNAME }}/ecs
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
|
name: Build
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
strategy:
|
|
|
|
|
fail-fast: true
|
|
|
|
|
max-parallel: 1
|
|
|
|
@ -36,38 +40,48 @@ jobs:
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
- name: Login to GHCR
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
|
registry: ${{ env.REGISTRY_GHCR }}
|
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Get git describe
|
|
|
|
|
id: gitdescribe
|
|
|
|
|
run: echo "ver=$(git describe --exact-match 2>/dev/null || echo latest)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
|
|
- name: Extract mix metadata (tags, labels) for Docker
|
|
|
|
|
- name: Extract mix metadata (tags, labels)
|
|
|
|
|
id: mixmeta
|
|
|
|
|
if: github.ref_type == 'tag'
|
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.MIX_IMAGE_NAME }}
|
|
|
|
|
images: |
|
|
|
|
|
${{ env.REGISTRY_GHCR }}/${{ env.MIX_IMAGENAME_GHCR }}
|
|
|
|
|
${{ env.REGISTRY_DOCKER }}/${{ env.MIX_IMAGENAME_DOCKERHUB }}
|
|
|
|
|
labels: |
|
|
|
|
|
org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }}
|
|
|
|
|
org.opencontainers.image.licenses=GPL-2.0
|
|
|
|
|
org.opencontainers.image.vendor=ProcessOne
|
|
|
|
|
|
|
|
|
|
- name: Extract ecs metadata (tags, labels) for Docker
|
|
|
|
|
- name: Extract ecs metadata (tags, labels)
|
|
|
|
|
id: ecsmeta
|
|
|
|
|
if: github.ref_type == 'tag'
|
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.ECS_IMAGE_NAME }}
|
|
|
|
|
images: |
|
|
|
|
|
${{ env.REGISTRY_GHCR }}/${{ env.ECS_IMAGENAME_GHCR }}
|
|
|
|
|
${{ env.REGISTRY_DOCKER }}/${{ env.ECS_IMAGENAME_DOCKERHUB }}
|
|
|
|
|
labels: |
|
|
|
|
|
org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }}
|
|
|
|
|
org.opencontainers.image.licenses=GPL-2.0
|
|
|
|
@ -77,18 +91,16 @@ jobs:
|
|
|
|
|
id: localreg
|
|
|
|
|
run: |
|
|
|
|
|
tag="$(echo ${{ github.ref_name }} | sed -e 's|[/]\+|-|g')"
|
|
|
|
|
echo "mixlocaltag=${{ env.REGISTRY_LOCAL }}/${{ env.MIX_IMAGE_NAME }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
echo "ecslocaltag=${{ env.REGISTRY_LOCAL }}/${{ env.ECS_IMAGE_NAME }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
echo "mixtag=${{ env.REGISTRY }}/${{ env.MIX_IMAGE_NAME }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
echo "ecstag=${{ env.REGISTRY }}/${{ env.ECS_IMAGE_NAME }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
echo "mixlocaltag=${{ env.REGISTRY_LOCAL }}/${{ env.MIX_IMAGENAME_GHCR }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
echo "ecslocaltag=${{ env.REGISTRY_LOCAL }}/${{ env.ECS_IMAGENAME_GHCR }}:$tag" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
with:
|
|
|
|
|
driver-opts: network=host
|
|
|
|
|
|
|
|
|
|
- name: Build and push local mix image
|
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
with:
|
|
|
|
|
build-args: |
|
|
|
|
|
VERSION=${{ steps.gitdescribe.outputs.ver }}
|
|
|
|
@ -100,13 +112,12 @@ jobs:
|
|
|
|
|
push: true
|
|
|
|
|
tags: |
|
|
|
|
|
${{ steps.localreg.outputs.mixlocaltag }}
|
|
|
|
|
${{ steps.mixmeta.outputs.tags }}
|
|
|
|
|
|
|
|
|
|
- name: Prepare ecs Dockerfile
|
|
|
|
|
run: sed -i 's|ejabberd/mix|${{ steps.localreg.outputs.mixlocaltag }}|g' ecs/Dockerfile
|
|
|
|
|
|
|
|
|
|
- name: Build and push local ecs image
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
with:
|
|
|
|
|
build-args: |
|
|
|
|
|
VERSION=${{ steps.gitdescribe.outputs.ver }}
|
|
|
|
@ -118,7 +129,6 @@ jobs:
|
|
|
|
|
push: true
|
|
|
|
|
tags: |
|
|
|
|
|
${{ steps.localreg.outputs.ecslocaltag }}
|
|
|
|
|
${{ steps.ecsmeta.outputs.tags }}
|
|
|
|
|
|
|
|
|
|
- name: Run ecs image
|
|
|
|
|
run: |
|
|
|
|
@ -143,7 +153,7 @@ jobs:
|
|
|
|
|
docker image save ${{ steps.localreg.outputs.ecslocaltag }} --output ejabberd-latest.tar
|
|
|
|
|
|
|
|
|
|
- name: Upload image
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
|
with:
|
|
|
|
|
name: ejabberd-image
|
|
|
|
|
path: ejabberd-latest.tar
|
|
|
|
@ -153,8 +163,8 @@ jobs:
|
|
|
|
|
"uncompress it and run: " \
|
|
|
|
|
"docker image load -i ejabberd-latest.tar"
|
|
|
|
|
|
|
|
|
|
- name: Build and push mix image to GHCR
|
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
|
- name: Build and push mix image
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
if: github.ref_type == 'tag'
|
|
|
|
|
with:
|
|
|
|
|
build-args: |
|
|
|
|
@ -166,11 +176,10 @@ jobs:
|
|
|
|
|
platforms: linux/amd64
|
|
|
|
|
push: true
|
|
|
|
|
tags: |
|
|
|
|
|
${{ steps.localreg.outputs.mixtag }}
|
|
|
|
|
${{ steps.mixmeta.outputs.tags }}
|
|
|
|
|
|
|
|
|
|
- name: Build and push ecs image to GHCR
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
- name: Build and push ecs image
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
if: github.ref_type == 'tag'
|
|
|
|
|
with:
|
|
|
|
|
build-args: |
|
|
|
|
@ -182,5 +191,4 @@ jobs:
|
|
|
|
|
platforms: linux/amd64
|
|
|
|
|
push: true
|
|
|
|
|
tags: |
|
|
|
|
|
${{ steps.localreg.outputs.ecstag }}
|
|
|
|
|
${{ steps.ecsmeta.outputs.tags }}
|
|
|
|
|