updated gh secrets #2
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/setup-buildx-action@v3 | |
with: | |
install: true | |
driver-opts: network=host | |
- uses: actions/checkout@v4 | |
- 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/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/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/build-push-action@v5 | |
with: | |
context: indico/worker | |
platforms: linux/amd64,linux/arm64 | |
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 | |
- 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 | |
publish-ghcr: | |
name: Publish to GHCR π | |
needs: build | |
runs-on: ubuntu-22.04 | |
environment: publish-ghcr | |
permissions: | |
packages: write | |
steps: | |
- 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/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker image π’ | |
run: | | |
docker push --all-tags ghcr.io/${{ github.repository_owner }}/indico | |
publish-dockerhub: | |
name: Publish to Docker Hub π’ | |
needs: build | |
runs-on: ubuntu-22.04 | |
environment: publish-dockerhub | |
steps: | |
- 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/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Push Docker image π’ | |
run: | | |
docker push --all-tags getindico/indico |