-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine docker deploy workflows #3701
Merged
danield9tqh
merged 1 commit into
iron-fish:staging
from
danield9tqh:daniel/ifl-283-make-single-github-action-for-deploying
Mar 28, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does
github.ref_name
refer to if this is triggered byworkflow_dispatch
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted with Daniel
the branch is always an input to
workflow_dispatch
, so this will refer to the branch that you run the workflow from