v0.2.0-beta.1 #19
Workflow file for this run
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: Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish-capi-yamls: | |
if: startsWith(github.ref, 'refs/tags/v') == true | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- id: get_version | |
run: | | |
RELEASE_VERSION=$(echo $GITHUB_REF | sed -nE 's!refs/tags/v!!p') | |
echo "release_version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: false | |
- name: Prepare all release files for the provider | |
run: | | |
make release TAG=$RELEASE_VERSION | |
env: | |
RELEASE_VERSION: ${{ steps.get_version.outputs.release_version }} | |
- name: Save release assets | |
uses: actions/upload-artifact@v1 | |
with: | |
name: release-assets | |
path: release/ | |
- name: Attach assets to release | |
uses: FabianKramm/release-asset-action@v1 | |
with: | |
pattern: "release/*" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
publish-images: | |
if: startsWith(github.ref, 'refs/tags/v') == true | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get_version | |
run: | | |
RELEASE_VERSION=$(echo $GITHUB_REF | sed -nE 's!refs/tags/!!p') | |
echo "release_version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | |
- name: Get Docker tags | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v2 | |
with: | |
images: | | |
loftsh/cluster-api-provider-vcluster | |
tags: | | |
type=semver,pattern={{version}} | |
type=raw,value=latest | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push the image | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
- name: Images digests | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
publish-release: | |
if: startsWith(github.ref, 'refs/tags/v') == true | |
needs: [publish-images] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 300 | |
- id: get_version | |
run: | | |
RELEASE_VERSION=$(echo $GITHUB_REF | sed -nE 's!refs/tags/!!p') | |
echo "release_version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | |
- uses: geertvdc/[email protected] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- run: | | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- run: | | |
STATE=$(hub release show "$RELEASE_VERSION" --format="%S" | sed -En "s/-//p") | |
EXTRA_ARGS="" | |
if [ "$STATE" != "" ]; then | |
EXTRA_ARGS="$EXTRA_ARGS --$STATE" | |
else | |
EXTRA_ARGS="$EXTRA_ARGS --prerelease=false --draft=false" | |
fi | |
hub release create -m "$RELEASE_VERSION" -m "" $EXTRA_ARGS "$RELEASE_VERSION" 2>/dev/null || hub release edit -m "$RELEASE_VERSION" -m "" $EXTRA_ARGS "$RELEASE_VERSION" | |
env: | |
RELEASE_VERSION: ${{ steps.get_version.outputs.release_version }} | |
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} |