diff --git a/.github/workflows/deploy-node-aws.yml b/.github/workflows/deploy-node-aws.yml deleted file mode 100644 index 60048fe360..0000000000 --- a/.github/workflows/deploy-node-aws.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Deploy Node Image to AWS -on: workflow_dispatch - -jobs: - Deploy: - name: Deploy - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v3 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Login to AWS Registry - run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL - env: - AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }} - - - name: Build Node Image - run: ./ironfish-cli/scripts/build-docker.sh - - - name: Deploy Node Image - run: ./ironfish-cli/scripts/deploy-docker.sh - env: - REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }} - PACKAGE_NAME: ironfish - GITHUB_REF: ${GITHUB_REF_NAME} - GITHUB_SHA: ${GITHUB_SHA} diff --git a/.github/workflows/deploy-node-docker-image.yml b/.github/workflows/deploy-node-docker-image.yml new file mode 100644 index 0000000000..f6001d6473 --- /dev/null +++ b/.github/workflows/deploy-node-docker-image.yml @@ -0,0 +1,120 @@ +name: Deploy Node Docker Image +on: + workflow_dispatch: + inputs: + github_tag_mainnet: + description: 'GitHub:mainnet' + type: boolean + default: false + github_tag_testnet: + description: 'GitHub:testnet' + type: boolean + default: false + aws_tag_mainnet: + description: 'AWS:mainnet' + type: boolean + default: false + aws_tag_testnet: + description: 'AWS:testnet' + type: boolean + default: false + aws_tag_git_sha: + description: 'AWS:{GIT_SHA}' + type: boolean + default: false + +permissions: + contents: read + packages: write + +jobs: + Deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Login to GitHub Registry + run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io + env: + GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }} + GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }} + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to AWS Registry + run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL + env: + AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }} + + - name: Build Node Image + run: ./ironfish-cli/scripts/build-docker.sh + + - name: Deploy Node Image to GitHub:mainnet + if: ${{ inputs.github_tag_mainnet }} + run: | + docker tag ironfish ghcr.io/iron-fish/ironfish:mainnet + docker push ghcr.io/iron-fish/ironfish:mainnet + + # If we are deploying a new public release to mainnet + # also update the docker registry :latest tag for hygiene + - name: Deploy Node Image to GitHub:latest + if: ${{ inputs.github_tag_mainnet }} + run: | + docker tag ironfish ghcr.io/iron-fish/ironfish:latest + docker push ghcr.io/iron-fish/ironfish:latest + + # Used if we are deploying a new version (e.g. v1.1) + # This is only executed when deploying a new release to mainnet + - name: Deploy Node Image to GitHub:${{ github.ref_name }} + if: ${{ inputs.github_tag_mainnet && github.event.ref_type == 'tag'}} + run: | + docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }} + docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }} + + - name: Deploy Node Image to GitHub:testnet + if: ${{ inputs.github_tag_testnet }} + run: | + docker tag ironfish ghcr.io/iron-fish/ironfish:testnet + docker push ghcr.io/iron-fish/ironfish:testnet + + - name: Deploy Node Image to AWS:mainnet + if: ${{ inputs.aws_tag_mainnet }} + run: | + docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet + docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet + + # If we are deploying a new public release to mainnet + # also update the docker registry :latest tag for hygiene + - name: Deploy Node Image to AWS:latest + if: ${{ inputs.aws_tag_mainnet }} + run: | + docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest + docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest + + # Used if we are deploying a new version (e.g. v1.1) + # This is only executed when deploying a new release to mainnet + - name: Deploy Node Image to AWS:${{ github.ref_name }} + if: ${{ inputs.aws_tag_mainnet && github.event.ref_type == 'tag'}} + run: | + docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }} + docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }} + + - name: Deploy Node Image to AWS:testnet + if: ${{ inputs.aws_tag_testnet }} + run: | + docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet + docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet + + - name: Deploy Node Image to AWS:${{ github.sha }} + if: ${{ inputs.aws_tag_git_sha }} + run: | + docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }} + docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }} diff --git a/.github/workflows/deploy-node-github-beta.yml b/.github/workflows/deploy-node-github-beta.yml deleted file mode 100644 index d59f7dfb1e..0000000000 --- a/.github/workflows/deploy-node-github-beta.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Deploy Node Image to Github Beta -on: workflow_dispatch - -permissions: - contents: read - packages: write - -jobs: - Deploy: - name: Deploy - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v3 - - - name: Login to Github Registry - run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io - env: - GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }} - GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }} - - - name: Build Node Image - run: ./ironfish-cli/scripts/build-docker.sh - - - name: Deploy Node Image to Github - run: ./ironfish-cli/scripts/deploy-docker.sh - env: - REGISTRY_URL: ghcr.io/iron-fish - PACKAGE_NAME: ironfish-beta - GITHUB_REF: ${GITHUB_REF_NAME} - GITHUB_SHA: "$GITHUB_SHA" diff --git a/.github/workflows/deploy-node-github.yml b/.github/workflows/deploy-node-github.yml deleted file mode 100644 index 9a7534fc89..0000000000 --- a/.github/workflows/deploy-node-github.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Deploy Node Image to Github -on: workflow_dispatch - -permissions: - contents: read - packages: write - -jobs: - Deploy: - name: Deploy - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v3 - - - name: Login to Github Registry - run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io - env: - GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }} - GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }} - - - name: Build Node Image - run: ./ironfish-cli/scripts/build-docker.sh - - - name: Deploy Node Image to Github - run: ./ironfish-cli/scripts/deploy-docker.sh - env: - REGISTRY_URL: ghcr.io/iron-fish - PACKAGE_NAME: ironfish - GITHUB_REF: ${GITHUB_REF_NAME} - GITHUB_SHA: ${GITHUB_SHA} diff --git a/ironfish-cli/scripts/deploy-docker.sh b/ironfish-cli/scripts/deploy-docker.sh deleted file mode 100755 index 3cea2277e6..0000000000 --- a/ironfish-cli/scripts/deploy-docker.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -cd "$(dirname "$0")" - -if [ -z "${REGISTRY_URL-}" ]; then - echo "Set REGISTRY_URL before running deploy-docker.sh" - exit 1 -fi - -if [ -z "${PACKAGE_NAME-}" ]; then - echo "Set PACKAGE_NAME before running deploy-docker.sh" - exit 1 -fi - -if [ -z "${GITHUB_SHA-}" ]; then - echo "Set GITHUB_SHA before running deploy-docker.sh" - exit 1 -fi - -if [ -z "${GITHUB_REF-}" ]; then - echo "Set GITHUB_REF before running deploy-docker.sh" - exit 1 -fi - -docker tag ironfish:latest ${REGISTRY_URL}/${PACKAGE_NAME}:latest -docker tag ironfish:latest ${REGISTRY_URL}/${PACKAGE_NAME}:${GITHUB_REF} -docker tag ironfish:latest ${REGISTRY_URL}/${PACKAGE_NAME}:${GITHUB_SHA} - -docker push --all-tags ${REGISTRY_URL}/${PACKAGE_NAME}