forked from boschresearch/catena-x-edc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload released helm charts to gh-pages (#148)
- Loading branch information
1 parent
6b6e83e
commit df1b198
Showing
1 changed file
with
72 additions
and
10 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ on: | |
|
||
jobs: | ||
secret-presence: | ||
name: Determine secret presence | ||
runs-on: ubuntu-latest | ||
outputs: | ||
CXNG_RELEASE_PAT: ${{ steps.secret-presence.outputs.CXNG_RELEASE_PAT }} | ||
|
@@ -20,16 +21,13 @@ jobs: | |
[ ! -z "${{ secrets.CXNG_RELEASE_PAT }}" ] && echo "::set-output name=CXNG_RELEASE_PAT::true" | ||
exit 0 | ||
release: | ||
name: Publish new release | ||
needs: [ secret-presence ] | ||
release-version: | ||
name: Determine release version | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && needs.secret-presence.outputs.CXNG_RELEASE_PAT | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.release-version.outputs.RELEASE_VERSION }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# 0 to fetch the full history due to upcoming merge of main into develop branch | ||
fetch-depth: 0 | ||
- | ||
name: Extract version from branch name (for release branches) | ||
if: startsWith(github.event.pull_request.head.ref, 'release/') | ||
|
@@ -46,13 +44,35 @@ jobs: | |
VERSION=${BRANCH_NAME#hotfix/} | ||
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | ||
- | ||
name: Output release version | ||
id: release-version | ||
run: | | ||
echo "::set-output name=RELEASE_VERSION::${{ env.RELEASE_VERSION }}" | ||
github-release: | ||
name: Publish new github release | ||
needs: [ secret-presence, release-version ] | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && needs.secret-presence.outputs.CXNG_RELEASE_PAT && needs.release-version.outputs.RELEASE_VERSION | ||
steps: | ||
- | ||
name: Export RELEASE_VERSION env | ||
run: | | ||
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
# 0 to fetch the full history due to upcoming merge of main into develop branch | ||
fetch-depth: 0 | ||
- | ||
name: Create Release Tag | ||
id: create_release_tag | ||
run: | | ||
# Prepare git env | ||
git config user.name "GitHub actions" | ||
git config user.email noreply@github.com | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected].github.aaakk.us.kg" | ||
# informative | ||
git branch -a | ||
|
@@ -104,3 +124,45 @@ jobs: | |
git commit --message "Introduce new snapshot version $SNAPSHOT_VERSION" | ||
git push origin develop | ||
helm-release: | ||
name: Publish new helm release | ||
needs: [ release-version ] | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && needs.release-version.outputs.RELEASE_VERSION | ||
steps: | ||
- | ||
name: Export RELEASE_VERSION env | ||
run: | | ||
echo "RELEASE_VERSION=${{ needs.release-version.outputs.RELEASE_VERSION }}" >> $GITHUB_ENV | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.8.1 | ||
- | ||
name: Package helm, update index.yaml and push to gh-pages | ||
run: | | ||
# Prepare git env | ||
git config user.name "GitHub actions" | ||
git config user.email [email protected] | ||
# Package all charts | ||
find -name Chart.yaml | xargs -n1 dirname | xargs -n1 helm package -u -d helm-charts | ||
git checkout gh-pages || git checkout -b gh-pages | ||
git pull --rebase origin gh-pages | ||
# Generate helm repo index.yaml | ||
helm repo index . --merge index.yaml --url https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}/ | ||
# Commit and push to gh-pages | ||
git add index.yaml helm-charts | ||
git commit -s -m "Release ${{ env.RELEASE_VERSION }}" | ||
git push origin gh-pages |