This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
Create Builder Release #19
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
# Copyright 2021-2022 VMware, Inc. | |
# SPDX-License-Identifier: BSD-2-Clause | |
name: Create Builder Release | |
env: | |
REGISTRY: ghcr.io | |
CONTAINER_PATH: ${{ github.repository }} | |
DEPENDENCY_BASE_URL: https://github.com/${{ github.repository }} | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
type: choice | |
description: The type of release | |
options: | |
- patch | |
- minor | |
- major | |
pre-release-label: | |
type: string | |
description: Pre-release label | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: version | |
uses: ./.github/actions/semver-bump | |
with: | |
path: ./builder/VERSION | |
release-type: ${{ github.event.inputs.release-type }} | |
pre-release: ${{ github.event.inputs.pre-release-label }} | |
- name: Bump Version | |
env: | |
version: "${{ steps.version.outputs.version }}" | |
run: | | |
printf $version > ./builder/VERSION | |
- name: Run Smoke Tests | |
env: | |
base_url: "${{ env.DEPENDENCY_BASE_URL }}" | |
registry: "${{ env.REGISTRY }}/${{ env.CONTAINER_PATH }}" | |
run: | | |
make base_url=$base_url registry.location=other REGISTRY=$registry smoke-tests | |
- name: Publish Container | |
env: | |
base_url: "${{ env.DEPENDENCY_BASE_URL }}" | |
registry: "${{ env.REGISTRY }}/${{ env.CONTAINER_PATH }}" | |
run: | | |
make base_url=$base_url registry.location=other REGISTRY=$registry builder.publish | |
- name: Commit Version | |
env: | |
version_file: "./builder/VERSION" | |
message: "Update builder version to ${{ steps.version.outputs.version }}" | |
run: | | |
git add $version_file | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m "${message}" | |
git push | |
- name: Create Tag | |
id: tag | |
env: | |
tag: "builder/v${{ steps.version.outputs.version }}" | |
run: | | |
git tag $tag | |
git push --tags | |
echo "::set-output name=tag::$tag" | |
- id: artifacts | |
env: | |
image_file: ./out/builder/${{ steps.version.outputs.version }}/builder.image | |
run: | | |
echo "::set-output name=image_file::${image_file}" | |
echo "::set-output name=image_file_content::$(head ${image_file})" | |
echo "::set-output name=image_sha_file::${image_file}.sha256" | |
echo "::set-output name=image_sha_file_content::$(head ${image_file}.sha256)" | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: builder v${{ steps.version.outputs.version }} | |
body: | | |
The builder image can be found at: | |
``` | |
${{ steps.artifacts.outputs.image_file_content }} | |
``` | |
# File Checksums | |
``` | |
${{ steps.artifacts.outputs.image_sha_file_content }} | |
``` | |
tag_name: ${{ steps.tag.outputs.tag }} | |
files: | | |
${{ steps.artifacts.outputs.image_file }} | |
${{ steps.artifacts.outputs.image_sha_file }} | |
token: ${{ secrets.GITHUB_TOKEN }} |