diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml index 4b1c1da..6f494f4 100644 --- a/.github/workflows/hello.yml +++ b/.github/workflows/hello.yml @@ -49,29 +49,28 @@ jobs: - name: Push images to repository run: make push ARGS="${REGISTRY}/" IMAGE_TAG="${IMAGE_SHA}" IMAGE_NAME=${IMAGE_NAME} - Deploy: + Deploy_test: runs-on: ubuntu-latest - - needs: Build + + needs: [ GetSHA, Build ] if: ${{ github.ref_type == 'branch' }} env: - - IMAGE_TAG: ${{ needs.GetSHA.outputs.IMAGE_SHA}} + IMAGE_SHA: ${{ needs.GetSHA.outputs.IMAGE_SHA}} steps: - - name: Deploy test + - name: Deploy Test uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.REMOTE_HOST_TEST }} username: ubuntu key: ${{ secrets.SSH_PRIVATE_KEY_TEST }} port: 22 - envs: GITHUB_ACTOR,SECRETS_GITHUB_TOKEN,IMAGE_NAME,IMAGE_TAG,REGISTRY + envs: GITHUB_ACTOR,SECRETS_GITHUB_TOKEN,IMAGE_NAME,IMAGE_SHA,REGISTRY script: | - echo "$GITHUB_ACTOR $REGISTRY $IMAGE_TAG $IMAGE_NAME $SECRETS_GITHUB_TOKEN IMAGE_SHA" > test.txt + echo "$GITHUB_ACTOR $REGISTRY $IMAGE_SHA $IMAGE_NAME $SECRETS_GITHUB_TOKEN" > test.txt echo "$SECRETS_GITHUB_TOKEN" | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin docker stop $IMAGE_NAME docker rm $IMAGE_NAME - docker run -d --name $IMAGE_NAME ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG} \ No newline at end of file + docker run -d --name $IMAGE_NAME ${REGISTRY}/${IMAGE_NAME}:${IMAGE_SHA} \ No newline at end of file