constellation/.github/workflows/build-bootstrapper.yml
dependabot[bot] f57a7e3ed0 Bump docker/setup-buildx-action from 1.7.0 to 2 (#285)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1.7.0 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](f211e3e9de...dc7b9719a9)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-25 12:14:17 +02:00

72 lines
2.8 KiB
YAML

# 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).
name: Build and Upload the bootstrapper
on:
workflow_dispatch:
push:
branches:
- main
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
jobs:
build-bootstrapper:
name: "Build the bootstrapper"
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:
bootstrapper-name: ${{ steps.copy.outputs.bootstrapper-name }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6
- name: Install Dependencies
id: prepare
run: sudo apt-get update && sudo apt-get -y install awscli cmake make
- name: Build and tag the bootstrapper
id: build
run: |
mkdir build && cd build
cmake ..
make bootstrapper
mv bootstrapper bootstrapper-$(sha512sum bootstrapper | cut -d " " -f 1)
- name: Copy bootstrapper to S3 if not exists
id: copy
# Only upload the bootstrapper if this action is triggered from main branch
if: ${{ github.ref == 'refs/heads/main' }}
run: >
aws s3api head-object --bucket ${{ secrets.PUBLIC_BUCKET_NAME }} --key bootstrapper/$(ls | grep "bootstrapper-")
|| (
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)
shell: bash {0}
working-directory: ${{ github.workspace }}/build/
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 }}