Skip to content

Push container to owner fork of Indico #3

Push container to owner fork of Indico

Push container to owner fork of Indico #3

Workflow file for this run

name: Docker build & release
on:
push:
tags: ['v*']
jobs:
build:
name: Build Docker image
runs-on: ubuntu-22.04
steps:
- uses: docker/[email protected]
- uses: actions/checkout@v3
- name: Get version
id: version
run: |
echo indico_version="${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
echo indico_version="${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker πŸ‘€
id: meta
uses: docker/[email protected]
with:
images: |
ghcr.io/indico/indico
getindico/indico
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.indico_version }}
type=semver,pattern={{major}}.{{minor}}.x,value=${{ steps.version.outputs.indico_version }}
- name: Build Docker image 🚒
uses: docker/[email protected]
with:
context: indico-prod/worker
build-args: tag=${{ steps.version.outputs.indico_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/indico-image.tar
- name: Test if Indico works πŸ§ͺ
run: |
docker load --input /tmp/indico-image.tar
cp indico.env.sample indico.env
sed -i -E 's/image: getindico\/indico:latest/image: getindico\/indico:${indico_version}/' docker-compose.yml
./test.sh
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Upload build artifact πŸ”Ό
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
# - name: Upload build artifact πŸ”Ό
# uses: actions/upload-artifact@v3
# with:
# name: indico-image
# retention-days: 1
# path: /tmp/indico-image.tar
publish-ghcr:
name: Publish to GHCR πŸ™
needs: build
runs-on: ubuntu-22.04
environment: publish-ghcr
permissions:
packages: write
steps:
# - name: Download build artifact πŸ”½
# uses: actions/download-artifact@v3
# with:
# name: indico-image
# path: /tmp/
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Download build artifact πŸ”½
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
- name: Import image
run: |
docker load --input /tmp/indico-image.tar
docker image ls -a | grep indico
- name: Log in to GHCR πŸ”‘
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push Docker image 🚒
run: |
OWNER=${GITHUB_REPOSITORY%/*}
docker push --all-tags ghcr.io/${OWNER}/indico
# - name: Delete build artifact πŸ—‘
# if: success() || failure()
# uses: geekyeggo/delete-artifact@v2
# with:
# name: indico-image
publish-dockerhub:
name: Publish to Docker Hub 🚒
needs: build
runs-on: ubuntu-22.04
environment: publish-dockerhub
steps:
# - name: Download build artifact πŸ”½
# uses: actions/download-artifact@v3
# with:
# name: indico-image
# path: /tmp/
# XXX Using the cache as a hack to workaround extremely slow artifact uploads (5 minutes+ for less than 1GB)
- name: Get unique run id
id: unique_id
run: |
echo "cache_key=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> $GITHUB_OUTPUT
- name: Download build artifact πŸ”½
uses: actions/cache@v3
with:
key: indico-image-${{ steps.unique_id.outputs.cache_key }}
path: /tmp/indico-image.tar
- name: Import image
run: |
docker load --input /tmp/indico-image.tar
docker image ls -a | grep indico
- name: Log in to Docker Hub πŸ”‘
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push Docker image 🚒
run: |
docker push --all-tags getindico/indico
# - name: Delete build artifact πŸ—‘
# if: success() || failure()
# uses: geekyeggo/delete-artifact@v2
# with:
# name: indico-image