-
Notifications
You must be signed in to change notification settings - Fork 1
ci: configure automated deployment #19
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
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ea5d85a
ci: configure automated deploy
luislhl d41c23b
send message to Slack
luislhl d7deac7
trigger build
luislhl d2b0b3f
trigger build
luislhl 995bb83
trigger build
luislhl fdc15b2
trigger build
luislhl 44aef2e
trigger build
luislhl be48482
trigger build
luislhl 680c5ac
trigger build
luislhl d0e856f
improve message
luislhl 79e7746
send message only in case of deploy
luislhl b0c403c
Remove TODO
luislhl 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 contains hidden or 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,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 | ||
|
|
||
| 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 | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this change?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a third-party action, it's safer to use the commit hash instead of a tag. |
||
|
|
||
| - name: Lint | ||
| run: yarn lint | ||
|
|
||
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.
Here you don't need to export the
DOCKER_IMAGE_TAG?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.
When it's not exported, the script creates a default for us with the
dev-prefix