Enable GHA #16
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 docker image | |
on: | |
push: | |
branches: | |
- master | |
- LISK-1400-Setup-Dshackle | |
env: | |
ECS_TASK_DEFINITION: task-definition.json | |
jobs: | |
docker: | |
name: Build and push docker image | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
submodules: recursive | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: 21 | |
- name: Setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-3 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a | |
- name: Docker image | |
id: docker-image | |
run: | | |
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}" >> $GITHUB_OUTPUT | |
- name: Build docker image | |
run: make jib-docker | |
- name: Update tags | |
run: | | |
docker tag liskhq/dshackle ${{ steps.docker-image.outputs.image }}:latest | |
docker tag liskhq/dshackle ${{ steps.docker-image.outputs.image }}:${{ github.sha }} | |
- name: Push Docker images to Amazon ECR | |
run: | | |
docker push --all-tags ${{ steps.docker-image.outputs.image }} |