Skip to content

Commit 62ed4f2

Browse files
author
Tom McLaughlin
committed
update pipelines
1 parent a3f1bed commit 62ed4f2

File tree

2 files changed

+30
-87
lines changed

2 files changed

+30
-87
lines changed

.github/workflows/branch.yml

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Branches
1+
name: Branch
2+
23
on:
34
workflow_dispatch:
45
push:
@@ -16,51 +17,22 @@ jobs:
1617
- name: Setup job workspace
1718
uses: ServerlessOpsIO/gha-setup-workspace@v1
1819

19-
- name: Assume AWS credentials
20-
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
21-
with:
22-
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
23-
24-
- name: Install AWS SAM
25-
uses: aws-actions/setup-sam@v2
26-
27-
- name: Validate template
28-
run: sam validate --lint
29-
30-
- name: Build deployment artifact
31-
run: sam build
32-
33-
- name: Store artifacts
34-
uses: ServerlessOpsIO/gha-store-artifacts@v1
35-
with:
36-
use_aws_sam: true
37-
38-
deploy:
39-
needs:
40-
- build
41-
42-
environment: production
43-
runs-on: ubuntu-latest
44-
permissions:
45-
id-token: write
46-
contents: read
47-
48-
steps:
49-
- name: Setup job workspace
50-
uses: ServerlessOpsIO/gha-setup-workspace@v1
51-
with:
52-
checkout_artifact: true
53-
54-
- name: Assume AWS credentials
20+
- name: Assume AWS Credentials
5521
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
5622
with:
5723
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
58-
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
5924

60-
- name: Deploy via AWS SAM
61-
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
25+
- name: Build container image
26+
uses: kciter/aws-ecr-action@v4
6227
with:
63-
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
64-
env_json: ${{ toJson(env) }}
65-
vars_json: ${{ toJson(vars) }}
66-
secrets_json: ${{ toJson(secrets) }}
28+
account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
29+
region: ${{ env.AWS_REGION }}
30+
tags: ${{ env.GITHUB_EVENT_REF_SLUG }},${{ env.GITHUB_SHA_SHORT }},${{ env.GITHUB_SHA }}
31+
repo: ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG}}
32+
create_repo: true
33+
# FIXME: This is a workaround to deal with how the action works and so we can
34+
# continue to use the aws-actions/configure-aws-credentials
35+
access_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
36+
secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
37+
set_repo_policy: true
38+
repo_policy_file: .github/workflows/ecr-policy.json

.github/workflows/main.yml

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,22 @@ jobs:
1717
- name: Setup job workspace
1818
uses: ServerlessOpsIO/gha-setup-workspace@v1
1919

20-
- name: Assume AWS credentials
20+
- name: Assume AWS Credentials
2121
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
2222
with:
2323
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
2424

25-
- name: Install AWS SAM
26-
uses: aws-actions/setup-sam@v2
27-
28-
- name: Validate template
29-
run: sam validate --lint
30-
31-
- name: Build deployment artifact
32-
run: sam build
33-
34-
- name: Store artifacts
35-
uses: ServerlessOpsIO/gha-store-artifacts@v1
36-
with:
37-
use_aws_sam: true
38-
39-
deploy:
40-
needs:
41-
- build
42-
43-
environment: production
44-
runs-on: ubuntu-latest
45-
permissions:
46-
id-token: write
47-
contents: read
48-
49-
steps:
50-
- name: Setup job workspace
51-
uses: ServerlessOpsIO/gha-setup-workspace@v1
52-
with:
53-
checkout_artifact: true
54-
55-
- name: Assume AWS credentials
56-
uses: ServerlessOpsIO/gha-assume-aws-credentials@v1
57-
with:
58-
build_aws_account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
59-
deploy_aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
60-
61-
- name: Deploy via AWS SAM
62-
uses: ServerlessOpsIO/gha-deploy-aws-sam@v1
25+
- name: Build container image
26+
uses: kciter/aws-ecr-action@v4
6327
with:
64-
aws_account_id: ${{ secrets.DEPLOYMENT_ACCOUNT_ID }}
65-
env_json: ${{ toJson(env) }}
66-
vars_json: ${{ toJson(vars) }}
67-
secrets_json: ${{ toJson(secrets) }}
28+
account_id: ${{ secrets.AWS_CICD_ACCOUNT_ID }}
29+
region: ${{ env.AWS_REGION }}
30+
tags: latest,${{ env.GITHUB_EVENT_REF_SLUG }},${{ env.GITHUB_SHA_SHORT }},${{ env.GITHUB_SHA }}
31+
repo: ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG}}
32+
create_repo: true
33+
# FIXME: This is a workaround to deal with how the action works and so we can
34+
# continue to use the aws-actions/configure-aws-credentials
35+
access_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
36+
secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
37+
set_repo_policy: true
38+
repo_policy_file: .github/workflows/ecr-policy.json

0 commit comments

Comments
 (0)