Skip to content

Commit

Permalink
Add action to push to codecommit mirror ripository
Browse files Browse the repository at this point in the history
  • Loading branch information
hozkaya2000 committed Nov 8, 2023
1 parent 540e763 commit dc0f832
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pushcodecommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PushToCodeCommit

on: workflow_dispatch

jobs:
PushToCodeCommit:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{secrets.AMI_MIRROR_ROLE}}
aws-region: us-west-2
- name: Delete shinkansen branch on codecommit repository
run: |
aws codecommit delete-branch --repository-name amazon-ecs-ami-mirror --branch-name shinkansen
- name: Configure prereqs
run: |
git config --global user.name "Github Action"
git config --global user.email "[email protected]"
pip install git-remote-codecommit
- name: Mirror to shinkansen branch on codecommit repository
run: |
git clone --single-branch --branch feature/shinkansen https://github.com/aws/amazon-ecs-ami ecsAmiGithub
git clone codecommit::us-west-2://amazon-ecs-ami-mirror ecsAmiCodeCommit
cp ecsAmiCodeCommit/Config ecsAmiGithub/
cd ecsAmiGithub
git add Config
git commit -m "Add config"
git remote add codecommit codecommit::us-west-2://amazon-ecs-ami-mirror
git push codecommit feature/shinkansen:shinkansen

0 comments on commit dc0f832

Please sign in to comment.