Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: deploy

on:
push:
branches: [dev, master, ci/deploy]
tags: ['v*.*.*']

env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'eu-central-1'

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Push Dev Image
if: github.ref == 'refs/heads/dev'
run: |
make build-and-push-docker
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you don't need to export the DOCKER_IMAGE_TAG?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's not exported, the script creates a default for us with the dev- prefix


echo "deployed_environment=dev-testnet" >> $GITHUB_ENV
- name: Push Testnet Image
if: github.ref == 'refs/heads/master'
run: |
commit=`git rev-parse HEAD`;
timestamp=`date +%s`;
export DOCKER_IMAGE_TAG="master-$commit-$timestamp";

make build-and-push-docker

echo "deployed_environment=testnet" >> $GITHUB_ENV
- name: Push Mainnet Image
if: startsWith(github.ref, 'refs/tags/v')
run: |
export DOCKER_IMAGE_TAG=${GITHUB_REF#refs/*/}
make build-and-push-docker

echo "deployed_environment=mainnet" >> $GITHUB_ENV
- name: Slack Notification
if: env.deployed_environment
uses: rtCamp/action-slack-notify@28e8b353eabda5998a2e1203aed33c5999944779
env:
SLACK_CHANNEL: deploys
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
SLACK_MESSAGE: 'Make sure the image is correctly deployed by checking if a new commit by fluxcdbot was made in: https://github.com/HathorNetwork/ops-tools/commits/master'
SLACK_TITLE: 'WalletServiceDaemon - new ${{ env.deployed_environment }} Docker image pushed :rocket:'
SLACK_USERNAME: HathorSlack
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: ''
MSG_MINIMAL: actions url
- name: Clean
run: |
rm /home/runner/.docker/config.json
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
uses: bahmutov/npm-install@c67aaab58a864ea2873950cde9c1c9379f9f711a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: Lint
run: yarn lint
Expand Down