Skip to content

Commit

Permalink
Add github repo cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Jan 31, 2024
1 parent 219761e commit 1cd0bd5
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/tools-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
required: true
type: string
targetVersion:
description: 'Target version to upgrade CRDs to'
description: 'Target version to upgrade CRDs to. If used with git, give the tag name'
required: true
type: string
repoName:
Expand All @@ -18,9 +18,23 @@ on:
description: 'URL of the target repository if repoName is set'
required: false
type: string
gitRepo:
description: 'git repository to be embedded in the image'
required: false
type: string
chartDir:
description: 'Directory of the chart in the git repository to be embedded in the image'
required: false
type: string
tokenSecret:
description: 'Secret name to be used as GitHub token if gitRepo is set'
required: false
type: string
jobs:
create_the_image:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets[format('{0}', inputs.tokenSecret)] }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -45,13 +59,25 @@ jobs:
run: |
echo "tag=${{ inputs.chartName }}-${{ inputs.targetVersion }}" >> $GITHUB_OUTPUT
- name: Download the requested charts
if: ${{ inputs.repoName }}
id: download_charts
run: |
helm repo add ${{ inputs.repoName }} ${{ inputs.repoURL }}
helm repo update
helm pull ${{ inputs.repoName }}/${{ inputs.chartName }} --version ${{ inputs.targetVersion }}
mkdir -p build/${{ inputs.repoName }}
tar -xvf ${{ inputs.chartName }}-${{ inputs.targetVersion }}.tgz -C build/${{ inputs.repoName }}
- name: Download the requested chart from another repository
if: ${{ !inputs.repoName }}
id: download_charts_github
run: |
gh repo clone ${{ inputs.gitRepo }} ${{ inputs.repoName }}
cd ${{ inputs.repoName }}
git checkout ${{ inputs.targetVersion }}
cd ..
mkdir -p build/${{ inputs.repoName }}
cp -R ${{ inputs.repoName }}/${{ inputs.chartDir }}/* build/${{ inputs.repoName }}
helm dependency update build/${{ inputs.repoName }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
Expand Down

0 comments on commit 1cd0bd5

Please sign in to comment.