-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Skylar Simoncelli
committed
Sep 18, 2024
1 parent
d53678d
commit eeaf719
Showing
6 changed files
with
130 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Build and Publish to ECR | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sha: | ||
description: "sha" | ||
tag: | ||
description: "tag" | ||
required: true | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download partner-chains-node-x86_64-linux-artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: partner-chains-node-x86_64-linux-artifact | ||
|
||
- name: Create and Configure Docker Container | ||
id: create-container | ||
run: | | ||
container_id=$(docker run -d debian:bullseye-slim sleep infinity) | ||
echo "container_id=$container_id" >> $GITHUB_ENV | ||
docker exec $container_id useradd -m -u 1000 -U -s /bin/sh -d /substrate substrate | ||
docker exec $container_id mkdir -p /data /substrate/.local/share/partner-chains-node | ||
docker exec $container_id chown -R substrate:substrate /data /substrate | ||
docker exec $container_id rm -rf /usr/bin/apt* /usr/bin/dpkg* | ||
docker exec $container_id ln -s /data /substrate/.local/share/partner-chains-node | ||
docker cp ./partner-chains-node-${{ inputs.tag }}-x86_64-linux $container_id:/usr/local/bin/partner-chains-node | ||
docker commit --change='EXPOSE 30333 9615 9933 9944' --change='ENTRYPOINT ["/usr/local/bin/partner-chains-node"]' $container_id substrate-node:${{ inputs.sha }} | ||
- name: Cleanup Docker Container | ||
if: always() | ||
run: | | ||
docker rm -f ${{ env.container_id }} | ||
- name: Acquire AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRET }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to ECR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ secrets.ECR_REGISTRY_SECRET }} | ||
|
||
- name: Push to ECR | ||
run: | | ||
docker tag substrate-node:${{ inputs.sha }} ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ inputs.sha }} | ||
docker push ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ inputs.sha }} |
Oops, something went wrong.