diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000..c4ddb06 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,5 @@ +FROM amazon/aws-cli:2.0.43 + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/github_codecommit.yml b/.github/workflows/github_codecommit.yml similarity index 58% rename from github_codecommit.yml rename to .github/workflows/github_codecommit.yml index 1d5e1a9..ee80e64 100644 --- a/github_codecommit.yml +++ b/.github/workflows/github_codecommit.yml @@ -32,8 +32,23 @@ jobs: role-session-name: GitHub_to_AWS_via_FederatedOIDC aws-region: ${{ env.AWS_REGION }} + - name: Install AWS + run: | + apt-get update && \ + apt-get install -y \ + python3 \ + python3-pip \ + python3-setuptools \ + groff \ + less \ + && pip3 install --upgrade pip \ + && apt-get clean + pip3 --no-cache-dir install --upgrade awscli + - name: Sync up to CodeCommit - uses: pay-theory/sync-up-to-codecommit-action@v1 - with: - repository_name: html-demo - aws_region: us-east-1 \ No newline at end of file + run: | + git config --global --add safe.directory /github/workspace + git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@' + git config --global credential.UseHttpPath true + git remote add sync "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/${GITHUB_REPOSITORY}" + git push sync --mirror \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..5585491 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -ue + +RepositoryName="${GITHUB_REPOSITORY}" +AwsRegion="us-east-1" +CodeCommitUrl="https://git-codecommit.${AwsRegion}.amazonaws.com/v1/repos/${RepositoryName}" + +git config --global --add safe.directory /github/workspace +git config --global credential.'https://git-codecommit.*.amazonaws.com'.helper '!aws codecommit credential-helper $@' +git config --global credential.UseHttpPath true +git remote add sync ${CodeCommitUrl} +git push sync --mirror \ No newline at end of file