-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Releases | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
# Remove when ready. | ||
- liljx | ||
paths: | ||
- "*/v*.*.*" | ||
# Remove when ready. | ||
- .github/workflows/releases.yaml | ||
|
||
jobs: | ||
get-releases: | ||
name: Get releases | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get releases | ||
id: get-releases | ||
run: echo releases="$(jq --null-input --args '$ARGS.positional' --compact-output -- {azure,capa}/v*.*.*)" >> "${GITHUB_OUTPUT}" | ||
|
||
outputs: | ||
releases: ${{ steps.get-releases.outputs.releases }} | ||
|
||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
needs: get-releases | ||
|
||
strategy: | ||
matrix: | ||
release: ${{ fromJSON(needs.get-releases.outputs.releases) }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Get provider & version | ||
id: get-provider-version | ||
env: | ||
release: ${{ matrix.release }} | ||
run: | | ||
# Get provider & version. | ||
provider="${release%/v*.*.*}" | ||
version="${release#${provider}/}" | ||
# Map provider. | ||
case "${provider}" in | ||
capa) | ||
provider="aws" | ||
;; | ||
esac | ||
# Store provider & version. | ||
echo provider="${provider}" >> "${GITHUB_OUTPUT}" | ||
echo version="${version}" >> "${GITHUB_OUTPUT}" | ||
- name: Get tag | ||
id: get-tag | ||
env: | ||
provider: ${{ steps.get-provider-version.outputs.provider }} | ||
version: ${{ steps.get-provider-version.outputs.version }} | ||
run: | | ||
# Define tag. | ||
tag="${provider}/${version}" | ||
# Check tag. | ||
[ "$(git tag --list "${tag}")" ] && exists=true || exists=false | ||
# Store tag & exists. | ||
echo tag="${tag}" >> "${GITHUB_OUTPUT}" | ||
echo exists="${exists}" >> "${GITHUB_OUTPUT}" | ||
- name: Create tag | ||
# if: ${{ ! steps.get-tag.outputs.exists }} | ||
env: | ||
GH_TOKEN: ${{ secrets.TAYLORBOT_GITHUB_ACTION }} | ||
provider: ${{ steps.get-provider-version.outputs.provider }} | ||
version: ${{ steps.get-provider-version.outputs.version }} | ||
tag: ${{ steps.get-tag.outputs.tag }} | ||
run: | | ||
# Debug. | ||
echo "${provider} | ${version} | ${tag}" | ||
# Define message. | ||
message="Workload cluster release ${version} for ${provider}" | ||
# Create tag. | ||
#git tag "${tag}" --message "${message}" | ||
# Push tag. | ||
#git push @{push} "${tag}" | ||
gh release view --repo giantswarm/releases "${tag}232" --json "id,name,tagName,assets,isDraft,isPrerelease,url" |