Check for Go before setup (#19) #8
This file contains hidden or 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
| --- | ||
|
Check failure on line 1 in .github/workflows/release-helm-charts.yml
|
||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright 2024 Intel Corporation | ||
| # Copyright 2024 Kyunghee University | ||
| # Copyright 2025 The Linux Foundation | ||
| name: Publish image and tag/release code | ||
| # Calling workflow should include "secrets: inherit" | ||
| # yamllint disable-line rule:truthy | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| charts_repo_url: | ||
| description: "URL for the helm repository to push to" | ||
| required: false | ||
| type: string | ||
| default: https://charts.aetherproject.org | ||
| remote_host: | ||
| description: "Address for host to sync charts to" | ||
| required: true | ||
| type: string | ||
| remote_path: | ||
| description: "Path on remote_host where charts should be stored" | ||
| required: true | ||
| type: string | ||
| jobs: | ||
| get-changed-charts-json: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| charts: ${{ steps.get-charts.outputs.charts_json }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get charts | ||
| id: get-charts | ||
| uses: onos-project/.github/.github/actions/find-all-charts-action@main | ||
| tag-github-vfile: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ hashFiles('VERSION') != '' }} | ||
| outputs: | ||
| changed: ${{ steps.version-change.outputs.changed }} | ||
| version: ${{ steps.version-change.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get changed | ||
| id: version-file | ||
| run: | | ||
| if git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep VERSION; then | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "VERSION file was not changed" | ||
| fi | ||
| - name: Validate change in version file | ||
| id: version-change | ||
| if: steps.version-file.outputs.changed == 'true' | ||
| run: | | ||
| version=$(cat VERSION) | ||
| echo "version=$version" | ||
| validate="^[0-9]+\.[0-9]+\.[0-9]+$" | ||
| if [[ $version =~ $validate ]]; then | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| echo "version=$version" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Version change not for release" | ||
| fi | ||
| - name: Create Github release | ||
| if: steps.version-change.outputs.changed == 'true' | ||
| uses: onos-project/.github/.github/actions/create-github-release-action@main | ||
| with: | ||
| version: ${{ steps.version-change.outputs.version }} | ||
| version-check: | ||
| uses: onosproject/.github/.github/workflows/version-check.yml@main | ||
| tag-versions: | ||
| runs-on: ubuntu-latest | ||
| needs: [get-changed-charts-json, version-check] | ||
| if: github.repository_owner == 'onosproject' | ||
| strategy: | ||
| matrix: | ||
| chart: ${{ fromJson(needs.get-changed-charts-json.outputs.charts) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get chart version | ||
| id: get_chart_version | ||
| uses: onos-project/.github/.github/actions/get-chart-version-action@main | ||
| with: | ||
| CHART_PATH: ${{ matrix.chart }}/Chart.yaml | ||
| - name: Release chart version | ||
| uses: onos-project/.github/.github/actions/create-github-release-action@main | ||
| with: | ||
| version: ${{ steps.get_chart_version.outputs.version }} | ||
| publish-charts: | ||
| runs-on: ubuntu-latest | ||
| needs: tag-versions | ||
| if: (github.repository_owner == 'onosproject') | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup yq | ||
| uses: vegardit/gha-setup-yq@v1 | ||
| - name: Setup Helm | ||
| uses: azure/setup-helm@v4 | ||
| with: | ||
| version: latest | ||
| token: ${{ secrets.GH_ONOS_PAT }} | ||
| - name: build | ||
| run: make deps | ||
| - name: Get charts | ||
| id: get-charts | ||
| uses: onos-project/.github/.github/actions/find-all-charts-action@main | ||
| - name: Publish all changed charts | ||
| # yamllint disable rule:line-length | ||
| run: | | ||
| target_charts=${{ steps.get-charts.outputs.charts }} | ||
| rm -rf staging && mkdir -p staging/${{ github.repository }} | ||
| while IFS= read -r tc | ||
| do | ||
| mkdir -p staging/${{ github.repository }}/$tc | ||
| tc_ver=$(yq e '.version' $tc/Chart.yaml) | ||
| helm package $tc --destination staging/${{ github.repository }}/$tc | ||
| done <<< $target_charts | ||
| cd staging | ||
| curl -o current-index.yaml ${{ inputs.charts_repo_url }}/index.yaml | ||
| helm repo index ${{ github.repository }} --url ${{ inputs.charts_repo_url }}/${{ github.repository }} --merge current-index.yaml | ||
| rm -rf current-index.yaml | ||
| mv ${{ github.repository }}/index.yaml . | ||
| cd .. | ||
| chmod -R g+r staging/ | ||
| # yamllint enable rule:line-length | ||
| - name: rsync deployments | ||
| uses: burnett01/rsync-deployments@7.0.1 | ||
| with: | ||
| switches: -rvzh | ||
| path: staging/ | ||
| remote_path: ${{ inputs.remote_path }} | ||
| remote_host: ${{ inputs.remote_host }} | ||
| remote_user: ${{ secrets.JENKINS_USERNAME }} | ||
| remote_key: ${{ secrets.JENKINS_SSHKEY }} | ||
| remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }} | ||