|
1 | | -name: Build joystream/apps and publish to Docker Hub |
| 1 | +name: Publish Colossus/Argus/QueryNode Docker images |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | | - inputs: |
6 | | - tag_suffix: |
7 | | - description: 'Tag suffix' |
8 | | - required: true |
| 5 | + pull_request: |
| 6 | + |
9 | 7 | jobs: |
10 | | - docker: |
| 8 | + build_and_publish: |
| 9 | + name: Build and Publish |
11 | 10 | runs-on: ubuntu-latest |
12 | 11 | steps: |
13 | 12 | - name: Checkout |
14 | 13 | uses: actions/checkout@v3 |
15 | | - - name: Extract branch name |
| 14 | + |
| 15 | + - uses: actions/setup-node@v3 |
| 16 | + with: |
| 17 | + node-version: '18.x' |
| 18 | + |
| 19 | + - name: Extract Package Versions |
| 20 | + id: extract_versions |
16 | 21 | shell: bash |
17 | | - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
18 | | - id: extract_branch |
| 22 | + run: | |
| 23 | + echo "colossus_version=$(cat storage-node/package.json | jq -r '.version')" >> $GITHUB_OUTPUT |
| 24 | + echo "argus_version=$(cat distributor-node/package.json | jq -r '.version')" >> $GITHUB_OUTPUT |
| 25 | + echo "qn_version=$(cat query-node/package.json | jq -r '.version')" >> $GITHUB_OUTPUT |
| 26 | +
|
| 27 | + - name: Set up Docker Buildx |
| 28 | + uses: docker/setup-buildx-action@v2 |
19 | 29 | - name: Login to DockerHub |
| 30 | + if: github.event_name == 'workflow_dispatch' |
20 | 31 | uses: docker/login-action@v2 |
21 | 32 | with: |
22 | 33 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
23 | 34 | password: ${{ secrets.DOCKERHUB_PASSWORD }} |
24 | | - - name: Build and push |
25 | | - id: docker_build |
| 35 | + |
| 36 | + - name: Build joystream-node |
| 37 | + run: RUNTIME_PROFILE=TESTING ./build-node-docker.sh |
| 38 | + |
| 39 | + # docker/build-push-action doc: |
| 40 | + # Be careful because any file mutation in the steps that precede the |
| 41 | + # build step will be ignored, including processing of the .dockerignore file |
| 42 | + # since the context is based on the Git reference. However, you can use |
| 43 | + # the Path context using the context input alongside the actions/checkout action |
| 44 | + # to remove this restriction. |
| 45 | + - name: Build storage-node |
26 | 46 | uses: docker/build-push-action@v3 |
27 | 47 | with: |
28 | | - file: apps.Dockerfile |
29 | | - push: true |
30 | | - tags: joystream/apps:${{ steps.extract_branch.outputs.branch }}-${{ github.event.inputs.tag_suffix }} |
| 48 | + # Do not use local dir context to ensure we can build from a commit directly |
| 49 | + # context: . |
| 50 | + file: colossus.Dockerfile |
| 51 | + push: false |
| 52 | + load: true |
| 53 | + tags: joystream/storage-node:latest |
| 54 | + - name: Build distributor-node |
| 55 | + uses: docker/build-push-action@v3 |
| 56 | + with: |
| 57 | + # Do not use local dir context to ensure we can build from a commit directly |
| 58 | + # context: . |
| 59 | + file: distributor-node.Dockerfile |
| 60 | + push: false |
| 61 | + load: true |
| 62 | + tags: joystream/distributor-node:latest |
| 63 | + - name: Build query-node |
| 64 | + uses: docker/build-push-action@v3 |
| 65 | + with: |
| 66 | + # Do not use local dir context to ensure we can build from a commit directly |
| 67 | + # context: . |
| 68 | + file: query-node.Dockerfile |
| 69 | + push: false |
| 70 | + load: true |
| 71 | + tags: joystream/query-node:latest |
| 72 | + |
| 73 | + - name: Test with latest images |
| 74 | + run: | |
| 75 | + yarn build:packages |
| 76 | + cp docker-compose-no-bind-volumes.yml docker-compose.yml |
| 77 | + ./tests/network-tests/run-test-node-docker.sh |
| 78 | + sleep 15 |
| 79 | + docker compose up -d db indexer hydra-indexer-gateway processor graphql-server |
| 80 | + sleep 30 |
| 81 | + ./tests/network-tests/start-storage.sh |
| 82 | + export REUSE_KEYS=true |
| 83 | + export SKIP_STORAGE_AND_DISTRIBUTION=true |
| 84 | + IGNORE_HIRED_LEADS=true ./tests/network-tests/run-test-scenario.sh content-directory |
| 85 | +
|
| 86 | + - name: Push new versions |
| 87 | + if: github.event_name == 'workflow_dispatch' |
| 88 | + run: | |
| 89 | + docker image tag joystream/storage-node:latest joystream/storage-node:${{ steps.extract_versions.outputs.colossus_version }} |
| 90 | + docker image tag joystream/distributor-node:latest joystream/distributor-node:${{ steps.extract_versions.outputs.argus_version }} |
| 91 | + docker image tag joystream/query-node:latest joystream/query-node:${{ steps.extract_versions.outputs.qn_version }} |
| 92 | + docker push joystream/storage-node:${{ steps.extract_versions.outputs.colossus_version }} |
| 93 | + docker push joystream/distributor-node:${{ steps.extract_versions.outputs.argus_version }} |
| 94 | + docker push joystream/query-node:${{ steps.extract_versions.outputs.qn_version }} |
| 95 | +
|
| 96 | + - name: Push latest tag |
| 97 | + if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' |
| 98 | + run: | |
| 99 | + docker push joystream/storage-node:latest |
| 100 | + docker push joystream/distributor:latest |
| 101 | + docker push joystream/query-node:latest |
| 102 | +
|
0 commit comments