Skip to content

Commit

Permalink
build images in gh
Browse files Browse the repository at this point in the history
  • Loading branch information
ggera committed Aug 19, 2024
1 parent f6ab246 commit 5c4c31d
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build Images

on:
push:
branches:
- github-runner

jobs:
build-images:
runs-on: ubuntu-latest
timeout-minutes: 120
env:
DOCKER_HUB_PARACHAIN: kiltprotocol/kilt-node
DOCKER_HUB_STANDALONE: kiltprotocol/standalone-node
DOCKER_HUB_DIP_PROVIDER_TEMPLATE: kiltprotocol/dip-provider-node-template
DOCKER_HUB_DIP_CONSUMER_TEMPLATE: kiltprotocol/dip-consumer-node-template
AWS_REGISTRY: ${{ secrets.ECR_REGISTRY }}
CI_COMMIT_SHORT_SHA: ${{ github.sha }}
CI_COMMIT_BRANCH: ${{ github.ref_name }}
CI_COMMIT_TAG: ${{ github.ref_name }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Checkout
uses: actions/checkout@v4

- name: Set up Cargo Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-build-images-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-images-
- name: Display AWS and Docker Versions
run: |
aws --version
docker --version
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ECR_ROLE }}
aws-region: ${{ secrets.ECR_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build Docker Images
run: |
./.maintain/build-image.sh build
- name: Push Image - Commit SHA
if: github.ref_type == 'branch'
run: |
./.maintain/push-image.sh build "${{ env.CI_COMMIT_SHORT_SHA }}"
- name: Push Image - Latest Branch
if: github.ref_type == 'branch'
run: |
./.maintain/push-image.sh build "latest-${{ env.CI_COMMIT_BRANCH }}"
- name: Push Image - Tag
if: startsWith(github.ref, 'refs/tags/')
run: |
./.maintain/push-image.sh build "${{ env.CI_COMMIT_TAG }}"
- name: Push Image - Latest
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-rc') && !contains(github.ref, 'dev-')
run: |
./.maintain/push-image.sh build "latest"

0 comments on commit 5c4c31d

Please sign in to comment.