Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add upbound release workflow #277

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/release-upbound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release Crossplane Provider

on:
workflow_run:
workflows:
- CD
types:
- completed
workflow_dispatch:
inputs:
version_tag:
description: 'The version tag to publish (e.g., v1.1.6)'
required: true

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Upbound CLI
run: |
curl -sL https://cli.upbound.io | sh
echo "::add-path::${HOME}/.upbound/bin"

- name: Login to Upbound
env:
UP_API_KEY: ${{ secrets.UP_API_KEY }}
run: up login --api-key $UP_API_KEY

- name: Set version tag for workflow_run
if: github.event_name == 'workflow_run'
run: |
VERSION_TAG=${{ github.event.workflow_run.head_branch }}

if [[ ! "$VERSION_TAG" =~ ^v[0-9]+(\.[0-9]+)?(\.[0-9]+)?(-[a-zA-Z0-9]+(\.[0-9]+)?)?$ ]]; then
echo "Invalid tag format: $VERSION_TAG. Expected a semantic versioning tag (e.g., v1, v1.0.0, v1.0.0-beta, v1.0.0-rc.2)."
exit 1
fi

echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV

- name: Set version tag for workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: echo "VERSION_TAG=${{ github.event.inputs.version_tag }}" >> $GITHUB_ENV

- name: Build and push Crossplane provider
run: |
up xpkg build --name provider-ionoscloud.xpkg
up xpkg push xpkg.upbound.io/ionos-cloud/provider-ionoscloud:${VERSION_TAG} -f provider-ionoscloud.xpkg
Loading