Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Test run #1

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
45 changes: 17 additions & 28 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,37 @@ name: Common Job
on:
workflow_call:
secrets:
PUBLISH_PACKAGES:
DOCKER_USERNAME:
required: true
AWS_ECR_ACCESS_KEY_ID:
required: true
AWS_ECR_SECRET_ACCESS_KEY:
required: true
AWS_ECR_REGION:
DOCKER_PASSWORD:
required: true

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
ENV_FILE: .env
GITHUB_ACCESS_TOKEN: ${{ secrets.PUBLISH_PACKAGES }}
name: Build and deploy the docker image to ECR

steps:
- name: Checkout Repository
uses: actions/checkout@v4

# Read the env file and expose the environment variables inside the gh action job
- name: Environment - Load the env variables from the env file
run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

- name: Download all the required jar files
run: make jars-get
- name: Docker - Buildx setup
uses: docker/setup-buildx-action@v3

- name: AWS - Configure credentials
uses: aws-actions/configure-aws-credentials@v4
- name: Login to DockerHub
uses: docker/login-action@v2
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_ECR_REGION }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: ECR - Login
id: ecr-login
uses: aws-actions/amazon-ecr-login@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
mask-password: 'true'

- name: Docker - Buildx setup
uses: docker/setup-buildx-action@v3
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-test
restore-keys: |
${{ runner.os }}-buildx-

- name: Docker - Build and Push
uses: docker/build-push-action@v6
Expand All @@ -55,4 +42,6 @@ jobs:
file: Dockerfile
platforms: linux/amd64,linux/arm64
context: .
tags: "${{ steps.ecr-login.outputs.registry }}/${{ github.event.repository.name }}:${{ env.VERSION }},${{ steps.ecr-login.outputs.registry }}/${{ github.event.repository.name }}:latest, ${{ steps.ecr-login.outputs.registry }}/${{ github.event.repository.name }}:${{ github.sha }}"
tags: "${{ secrets.DOCKER_USERNAME }}/caching_issues:latest, ${{ secrets.DOCKER_USERNAME }}/caching_issues:${{ github.sha }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,new=true
6 changes: 2 additions & 4 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ jobs:
build:
uses: ./.github/workflows/deploy.yaml
secrets:
PUBLISH_PACKAGES: ${{ secrets.PUBLISH_PACKAGES }}
AWS_ECR_ACCESS_KEY_ID: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
AWS_ECR_SECRET_ACCESS_KEY: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
AWS_ECR_REGION: ${{ secrets.AWS_ECR_REGION }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
console.log("Test");
console.log("Test 1");


34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"bugs": {
"url": "https://github.com/CandisIO/caching_issue/issues"
},
"homepage": "https://github.com/CandisIO/caching_issue#readme"
"homepage": "https://github.com/CandisIO/caching_issue#readme",
"dependencies": {
"dotenv": "^16.4.5"
}
}
Loading