Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |