Skip to content

Commit 6d86370

Browse files
committed
use workflow dispatch for release
1 parent 0d1913b commit 6d86370

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (without v prefix, e.g. 1.2.3)'
11+
required: true
12+
type: string
13+
714
env:
8-
RELEASE_VERSION: ${{ github.ref_name }}
9-
IMG: ghcr.io/openvirtualcluster/openvirtualcluster-operator:${{ github.ref_name }}
15+
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', github.event.inputs.version) || github.ref_name }}
16+
IMG: ghcr.io/openvirtualcluster/openvirtualcluster-operator:${{ github.event_name == 'workflow_dispatch' && format('v{0}', github.event.inputs.version) || github.ref_name }}
1017

1118
jobs:
1219
build-and-push:
@@ -17,6 +24,11 @@ jobs:
1724
steps:
1825
- name: Checkout code
1926
uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v2
2032

2133
- name: Set up Docker Buildx
2234
uses: docker/setup-buildx-action@v2
@@ -30,13 +42,26 @@ jobs:
3042

3143
- name: Extract version
3244
id: get_version
33-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
34-
35-
- name: Build and push
3645
run: |
37-
make docker-buildx
38-
env:
39-
IMG: ${{ env.IMG }}
46+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
47+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
48+
else
49+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Build and push multi-platform image
53+
uses: docker/build-push-action@v4
54+
with:
55+
context: .
56+
platforms: linux/amd64,linux/arm64
57+
push: true
58+
tags: ${{ env.IMG }}
59+
labels: |
60+
org.opencontainers.image.title=openvirtualcluster-operator
61+
org.opencontainers.image.description=OpenVirtualCluster Operator
62+
org.opencontainers.image.version=${{ steps.get_version.outputs.VERSION }}
63+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
64+
org.opencontainers.image.revision=${{ github.sha }}
4065
4166
release:
4267
needs: build-and-push
@@ -46,6 +71,8 @@ jobs:
4671
steps:
4772
- name: Checkout
4873
uses: actions/checkout@v3
74+
with:
75+
fetch-depth: 0
4976

5077
- name: Create directory for changelog config
5178
run: mkdir -p .github/workflows/changelog_builder

0 commit comments

Comments
 (0)