This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
105 lines (101 loc) · 3.46 KB
/
create-builder-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# 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 github-actions@github.com
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 }}