Skip to content

Commit

Permalink
Publish image to both github an aws in same job
Browse files Browse the repository at this point in the history
  • Loading branch information
Sturle Nordeide committed Feb 12, 2023
1 parent b03d25e commit c9b0f87
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 48 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/AWS-ECR.yml

This file was deleted.

25 changes: 21 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ name: Docker

on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]


env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand Down Expand Up @@ -73,3 +70,23 @@ jobs:
env:
COSIGN_EXPERIMENTAL: "true"
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-north-1

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

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: docker_nodejs_demo
IMAGE_TAG: nodejs_demo_image
run: |
docker build -t 037288042502.dkr.ecr.eu-north-1.amazonaws.com/origo-batch:latest .
docker push 037288042502.dkr.ecr.eu-north-1.amazonaws.com/origo-batch:latest
2 changes: 1 addition & 1 deletion src/main/java/no/stunor/origo/batch/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CommandLineRunner start(DynamoDBService dynamoDBService, EventorService e
log.info("Start update organisations in {}.", eventor.getName());
try {
List<Organisation> organisations = eventorService.getOrganisations(eventor.getBaseUrl(), eventor.getApiKey()).getOrganisation();
log.info("Fond {} organisations in {}.", organisations.size(), eventor.getName());
log.info("Found {} organisations in {}.", organisations.size(), eventor.getName());
} catch (EventorApiException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit c9b0f87

Please sign in to comment.