2022-07-08 04:59:59 -04:00
# We build the bootstrapper 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-06-29 09:26:29 -04:00
name : Build and Upload the bootstrapper
2022-03-22 11:03:15 -04:00
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 :
2022-06-29 09:26:29 -04:00
build-bootstrapper :
name : "Build the bootstrapper"
2022-03-22 11:03:15 -04:00
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 :
2022-06-29 09:26:29 -04:00
bootstrapper-name : ${{ steps.copy.outputs.bootstrapper-name }}
2022-03-22 11:03:15 -04:00
steps :
- name : Checkout
id : checkout
2022-07-20 04:48:01 -04:00
uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2022-03-22 11:03:15 -04:00
- name : Set up Docker Buildx
2022-07-25 06:14:17 -04:00
uses : docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6
2022-03-22 11:03:15 -04:00
- 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-29 09:26:29 -04:00
- name : Build and tag the bootstrapper
2022-06-01 11:17:37 -04:00
id : build
2022-03-22 11:03:15 -04:00
run : |
2022-06-01 11:17:37 -04:00
mkdir build && cd build
cmake ..
2022-06-29 09:26:29 -04:00
make bootstrapper
mv bootstrapper bootstrapper-$(sha512sum bootstrapper | cut -d " " -f 1)
2022-03-22 11:03:15 -04:00
2022-06-29 09:26:29 -04:00
- name : Copy bootstrapper to S3 if not exists
2022-03-22 11:03:15 -04:00
id : copy
2022-07-08 04:59:59 -04:00
# Only upload the bootstrapper if this action is triggered from main branch
2022-07-07 05:28:12 -04:00
if : ${{ github.ref == 'refs/heads/main' }}
2022-03-22 11:03:15 -04:00
run : >
2022-06-29 09:26:29 -04:00
aws s3api head-object --bucket ${{ secrets.PUBLIC_BUCKET_NAME }} --key bootstrapper/$(ls | grep "bootstrapper-")
2022-03-22 11:03:15 -04:00
|| (
2022-06-29 09:26:29 -04:00
echo "::set-output name=bootstrapper-name::$(ls | grep "bootstrapper-")"
&& aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/bootstrapper/ --exclude "*" --include "bootstrapper-*" --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-07-28 03:56:49 -04:00
# This is disabled for now as release images need to be built manually anyway.
# For cases where you need a new image because of bootstrapper changes, either trigger a manual build or use a debug image.
# call-coreos:
# needs: build-bootstrapper
# if: ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-bootstrapper.outputs.bootstrapper-name, 'bootstrapper-') }}
# uses: ./.github/workflows/build-coreos.yml
# with:
# bootstrapper-name: ${{ needs.build-bootstrapper.outputs.bootstrapper-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 }}