Skip to content

Colossus archive script #929

Colossus archive script

Colossus archive script #929

name: Publish Colossus/Argus/QueryNode Docker images
on:
workflow_dispatch:
inputs:
packages:
description: 'Comma-separated list of packages to publish to Docker Hub'
required: true
default: '*'
pull_request:
jobs:
build_and_publish:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Extract Package Versions
id: extract_versions
shell: bash
run: |
echo "colossus_version=`cat storage-node/package.json | jq -r '.version'`" >> $GITHUB_OUTPUT
echo "argus_version=`cat distributor-node/package.json | jq -r '.version'`" >> $GITHUB_OUTPUT
echo "qn_version=`cat query-node/package.json | jq -r '.version'`" >> $GITHUB_OUTPUT
- name: Make some space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: github.event_name == 'workflow_dispatch'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build joystream-node
if: github.event_name == 'pull_request'
run: |
RUNTIME_PROFILE=TESTING ./build-node-docker.sh
# reclaim some disk space
docker system prune --force
# docker/build-push-action doc:
# Be careful because any file mutation in the steps that precede the
# build step will be ignored, including processing of the .dockerignore file
# since the context is based on the Git reference. However, you can use
# the Path context using the context input alongside the actions/checkout action
# to remove this restriction.
- name: Build storage-node
uses: docker/build-push-action@v3
with:
# Do not use local dir context to ensure we can build from a commit directly
# context: .
file: colossus.Dockerfile
push: false
load: true
tags: joystream/storage-node:latest
- name: reclaim disk space
run: docker system prune --force
- name: Build distributor-node
uses: docker/build-push-action@v3
with:
# Do not use local dir context to ensure we can build from a commit directly
# context: .
file: distributor-node.Dockerfile
push: false
load: true
tags: joystream/distributor-node:latest
- name: reclaim disk space
run: docker system prune --force
- name: Build query-node
uses: docker/build-push-action@v3
with:
# Do not use local dir context to ensure we can build from a commit directly
# context: .
file: query-node.Dockerfile
push: false
load: true
tags: joystream/query-node:latest
- name: Test with latest images
if: github.event_name == 'pull_request'
run: |
docker system prune --force
yarn build
cp docker-compose-no-bind-volumes.yml docker-compose.yml
./tests/network-tests/run-tests.sh content-directory
- name: Push storage-node
if: contains(github.event.inputs.packages, 'storage-node') || github.event.inputs.packages == '*'
run: |
docker image tag joystream/storage-node:latest joystream/storage-node:${{ steps.extract_versions.outputs.colossus_version }}
docker push joystream/storage-node:${{ steps.extract_versions.outputs.colossus_version }}
- name: Push distributor-node
if: contains(github.event.inputs.packages, 'distributor-node') || github.event.inputs.packages == '*'
run: |
docker image tag joystream/distributor-node:latest joystream/distributor-node:${{ steps.extract_versions.outputs.argus_version }}
docker push joystream/distributor-node:${{ steps.extract_versions.outputs.argus_version }}
- name: Push query-node
if: contains(github.event.inputs.packages, 'query-node') || github.event.inputs.packages == '*'
run: |
docker image tag joystream/query-node:latest joystream/query-node:${{ steps.extract_versions.outputs.qn_version }}
docker push joystream/query-node:${{ steps.extract_versions.outputs.qn_version }}
- name: Push storage-node latest tag
if: github.ref == 'refs/heads/master' && (contains(github.event.inputs.packages, 'storage-node') || github.event.inputs.packages == '*')
run: docker push joystream/storage-node:latest
- name: Push distributor-node latest tag
if: github.ref == 'refs/heads/master' && (contains(github.event.inputs.packages, 'distributor-node') || github.event.inputs.packages == '*')
run: docker push joystream/distributor-node:latest
- name: Push query-node latest tag
if: github.ref == 'refs/heads/master' && (contains(github.event.inputs.packages, 'query-node') || github.event.inputs.packages == '*')
run: docker push joystream/query-node:latest