Skip to content

Commit

Permalink
Changed user to repository_owner and tuned version calculating
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreenwood committed Apr 3, 2024
1 parent 1818767 commit 81ca8be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_upload_on_push_to_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_helm_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Define Helm Chart version (taken from input or latest snapshot)
run: |
VERSION=$(cat ./VERSION)-SNAPSHOT
VERSION=$(cat ./VERSION)
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION=${{ github.event.inputs.version }}
fi
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/package_and_push_helm_chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ on:
inputs:
name:
description: "Manual trigger for Helm chart packaging and pushing"
release_type:
description: "Release or snapshot version?"
required: true
default: "SNAPSHOT"
options:
- "SNAPSHOT"
- "RELEASE"
version:
description: "Version of the Helm chart to push"
required: false

jobs:
deploy:
Expand All @@ -32,14 +28,20 @@ jobs:

- name: Login with Helm
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ vars.HELM_REGISTRY }} --username ${{ github.repository_owner }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ vars.HELM_REGISTRY }} --username ${{ github.actor }} --password-stdin
- name: Prepare version
run: |
VERSION=$(cat ./VERSION)
if [[ ${{ github.event.inputs.release_type }} = "SNAPSHOT" ]] || [[ $BRANCH = "dev" ]]; then
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
if [ $BRANCH != "release" ]
then
VERSION=$VERSION-SNAPSHOT
fi
# override version of custom input is provided
if [ "${{ github.event.inputs.version != '' }}" ]; then
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Push Helm chart to repository
Expand All @@ -48,7 +50,3 @@ jobs:
helm package "charts/fairspace" --version ${{ env.VERSION }}
helm push "fairspace-${{ env.VERSION }}.tgz" "oci://${{ vars.HELM_REGISTRY }}"
echo "Pushed package to repository"
- name: Clean up
run: |
rm -rf "fairspace*.tgz"

0 comments on commit 81ca8be

Please sign in to comment.