Update ubuntu-focal base image (20230922) (#67) #20
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
name: Build and publish images | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
read_builds: | |
runs-on: ubuntu-latest | |
outputs: | |
builds: ${{ steps.builds-as-json.outputs.builds }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Install script dependencies | |
run: pip install -r ./requirements.txt | |
- name: Get builds as JSON | |
id: builds-as-json | |
run: ./bin/builds-as-json | |
build_images: | |
needs: [read_builds] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.read_builds.outputs.builds) }} | |
name: ${{ matrix.name }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Write OpenStack credentials | |
run: echo "$CLOUDS_YAML_B64" | base64 -d > ./clouds.yaml | |
env: | |
CLOUDS_YAML_B64: ${{ secrets.CLOUDS_YAML_B64 }} | |
- name: Set up Packer environment | |
run: ./bin/setup | |
env: | |
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
id: build-image | |
run: ./bin/build-image | |
env: | |
OS_CLOUD: openstack | |
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ENVIRONMENT: arcus | |
PACKER_TEMPLATE: ${{ matrix.template }} | |
ENV_VAR_FILES: ${{ matrix.var-files }} | |
- name: Publish image | |
id: publish-image | |
run: ./bin/publish-image | |
env: | |
OS_CLOUD: openstack | |
ENVIRONMENT: arcus | |
ENV_VAR_FILES: ${{ matrix.var-files }} | |
IMAGE_ID: ${{ steps.build-image.outputs.image-id }} | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
- name: Write matrix outputs | |
uses: cloudposse/[email protected] | |
with: | |
matrix-step-name: ${{ github.job }} | |
matrix-key: ${{ matrix.name }} | |
outputs: |- | |
name: ${{ steps.publish-image.outputs.image-name }} | |
url: ${{ steps.publish-image.outputs.image-url }} | |
checksum: ${{ steps.publish-image.outputs.image-checksum }} | |
manifest-extra: ${{ steps.build-image.outputs.manifest-extra }} | |
publish_manifest: | |
needs: [build_images] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Read matrix outputs | |
id: matrix-outputs | |
uses: cloudposse/[email protected] | |
with: | |
matrix-step-name: build_images | |
- name: Write outputs | |
uses: DamianReeves/write-file-action@0a7fcbe1960c53fc08fe789fa4850d24885f4d84 | |
with: | |
path: build-outputs.json | |
write-mode: overwrite | |
contents: ${{ steps.matrix-outputs.outputs.result }} | |
- name: Generate manifest | |
run: ./bin/generate-manifest | |
env: | |
BUILD_OUTPUTS_FILE: ./build-outputs.json | |
MANIFEST_FILE: ./manifest.json | |
- name: Install s3cmd | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y s3cmd | |
- name: Publish manifest to S3 | |
run: ./bin/publish-manifest | |
env: | |
MANIFEST_FILE: ./manifest.json | |
ENVIRONMENT: arcus | |
ENV_VAR_FILES: common | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
purge_previous: | |
needs: [publish_manifest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Install s3cmd | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y s3cmd | |
- name: Purge images from previous commit | |
run: ./bin/purge-previous | |
env: | |
ENVIRONMENT: arcus | |
ENV_VAR_FILES: common | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} |