Browse Source

workflows: only build if artifact not found

Mokhtar Naamani 4 years ago
parent
commit
f456a29511
1 changed files with 9 additions and 7 deletions
  1. 9 7
      .github/workflows/run-network-tests-pull-request.yml

+ 9 - 7
.github/workflows/run-network-tests-pull-request.yml

@@ -52,23 +52,25 @@ jobs:
           docker image tag joystream/node:${JOYSTREAM_NODE_TAG} joystream/node:latest
           docker save --output joystream-node-docker-image.tar joystream/node:latest
           gzip joystream-node-docker-image.tar
-          echo "::set-env name=UPLOAD_ARTIFACT::true"
+          echo "::set-env name=UPLOAD_NEW_ARTIFACT::true"
         if: failure()
 
       - name: Build new joystream/node image
         run: |
-          docker-compose build
-          docker save --output joystream-node-docker-image.tar joystream/node
-          gzip joystream-node-docker-image.tar
-          echo "::set-env name=UPLOAD_ARTIFACT::true"
-        if: failure()
+          if ! [ -f joystream-node-docker-image.tar.gz ]; then
+            export JOYSTREAM_NODE_TAG=latest
+            docker-compose build
+            docker save --output joystream-node-docker-image.tar joystream/node
+            gzip joystream-node-docker-image.tar
+            echo "::set-env name=UPLOAD_NEW_ARTIFACT::true"
+          fi
 
       - name: Save joystream/node image to Artifacts
         uses: actions/upload-artifact@v2
         with:
           name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
           path: joystream-node-docker-image.tar.gz
-        if: env.UPLOAD_ARTIFACT
+        if: env.UPLOAD_NEW_ARTIFACT
 
   network_tests_1:
     name: Network Integration Tests (pull request)