Build, push and deploy aleph-wallet image #77
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
name: Build, push and deploy aleph-wallet image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- alephzero | |
paths-ignore: | |
- ".github/**" | |
- "*.md" | |
jobs: | |
deploy-wallet: | |
name: Build and push wallet image | |
runs-on: ubuntu-latest | |
steps: | |
- name: GIT | Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: GIT | Checkout Source code | |
uses: actions/checkout@v2 | |
- name: GIT | Get branch info & current commit sha. | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 # this region is used by all public ECR repos | |
- name: Login to Public Amazon ECR | |
id: login-public-ecr | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: v0.9.1 | |
- name: Build and push latest docker image for Wallet | |
id: build-image | |
env: | |
RELEASE_IMAGE: public.ecr.aws/p6e8q1z1/aleph-wallet:${{ steps.vars.outputs.sha_short }} | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ env.RELEASE_IMAGE }} | |
- name: GIT | Checkout aleph-apps repo | |
uses: actions/checkout@master | |
with: | |
repository: Cardinal-Cryptography/aleph-apps | |
token: ${{ secrets.CI_GH_TOKEN }} | |
path: "aleph-apps" | |
- name: Init kustomize | |
uses: imranismail/setup-kustomize@v2 | |
with: | |
kustomize-version: ${{ vars.KUSTOMIZE_VERSION }} | |
- name: Update aleph-wallet devnet kustomize file and trigger ArgoCD deploy | |
env: | |
RELEASE_IMAGE: public.ecr.aws/p6e8q1z1/aleph-wallet:${{ steps.vars.outputs.sha_short }} | |
REGIONS_AWS: 'eu-central-1' | |
run: | | |
# Deploy new image version for aleph-wallet | |
cd aleph-apps/aleph-wallet/overlays/devnet/${{ env.REGIONS_AWS }} | |
kustomize edit set image "aleph-wallet-image-placeholder=${{ env.RELEASE_IMAGE }}" | |
- name: GIT | Commit changes to aleph-apps repository. | |
uses: EndBug/[email protected] | |
with: | |
author_name: AlephZero Automation | |
author_email: [email protected] | |
message: "Updating aleph-wallet docker image tag to: ${{ steps.vars.outputs.sha_short }}" | |
add: "*.yaml" | |
cwd: "aleph-apps" | |
branch: main | |
env: | |
GITHUB_TOKEN: ${{ secrets.CI_GH_TOKEN }} | |
- name: Send Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
continue-on-error: true | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: GithubActions | |
SLACK_TITLE: deploy-wallet job has finished | |
MSG_MINIMAL: actions url |