2022-06-30 05:27:23 -04:00
# We build the coordinator as part of each PR to see that the build still works. An image is only created once merged to main (see condition on call-coreos).
2022-03-22 11:03:15 -04:00
name : Build and Upload the Coordinator
on :
workflow_dispatch :
push :
branches :
- main
2022-06-30 05:27:23 -04:00
pull_request :
# Abort runs of *this* workflow, if a new commit with the same ref is pushed.
concurrency :
group : ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress : true
2022-03-22 11:03:15 -04:00
jobs :
build-coordinator :
name : "Build the Coordinator"
runs-on : ubuntu-latest
env :
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION : ${{ secrets.AWS_DEFAULT_REGION }}
outputs :
coordinator-name : ${{ steps.copy.outputs.coordinator-name }}
steps :
- name : Checkout
id : checkout
uses : actions/checkout@v2
- name : Set up Docker Buildx
uses : docker/setup-buildx-action@v1
- name : Install Dependencies
id : prepare
2022-06-01 11:17:37 -04:00
run : sudo apt-get update && sudo apt-get -y install awscli cmake make
2022-03-22 11:03:15 -04:00
2022-06-01 11:17:37 -04:00
- name : Build and tag the Coordinator
id : build
2022-03-22 11:03:15 -04:00
run : |
2022-06-01 11:17:37 -04:00
mkdir build && cd build
cmake ..
make coordinator
mv coordinator coordinator-$(sha512sum coordinator | cut -d " " -f 1)
2022-03-22 11:03:15 -04:00
- name : Copy Coordinator to S3 if not exists
id : copy
2022-07-07 05:28:12 -04:00
# Only upload the Coordinator if this action is triggered from main branch
if : ${{ github.ref == 'refs/heads/main' }}
2022-03-22 11:03:15 -04:00
run : >
aws s3api head-object --bucket ${{ secrets.PUBLIC_BUCKET_NAME }} --key coordinator/$(ls | grep "coordinator-")
|| (
echo "::set-output name=coordinator-name::$(ls | grep "coordinator-")"
2022-06-01 11:17:37 -04:00
&& aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/coordinator/ --exclude "*" --include "coordinator-*" --include "constellation" --recursive --quiet)
2022-03-22 11:03:15 -04:00
shell : bash {0}
2022-06-01 11:17:37 -04:00
working-directory : ${{ github.workspace }}/build/
2022-03-22 11:03:15 -04:00
call-coreos :
needs : build-coordinator
2022-07-06 10:41:48 -04:00
if : ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-coordinator.outputs.coordinator-name, 'coordinator-') }}
2022-03-22 11:03:15 -04:00
uses : ./.github/workflows/build-coreos.yml
with :
coordinator-name : ${{ needs.build-coordinator.outputs.coordinator-name }}
secrets :
CI_GITHUB_REPOSITORY : ${{ secrets.CI_GITHUB_REPOSITORY }}
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION : ${{ secrets.AWS_DEFAULT_REGION }}
BUCKET_NAME : ${{ secrets.BUCKET_NAME }}
PUBLIC_BUCKET_NAME : ${{ secrets.PUBLIC_BUCKET_NAME }}
AZURE_CREDENTIALS : ${{ secrets.AZURE_CREDENTIALS }}