fix: operator pipeline trigger based on operator files path #44
Workflow file for this run
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
| name: Build and Publish Extension [Container and Helm Chart] | |
| on: [push, pull_request, workflow_dispatch] | |
| env: | |
| CHART_PATH: charts/suse-ai-lifecycle-manager | |
| CHART_REGISTRY: oci://ghcr.io/suse/chart | |
| jobs: | |
| build-extension: | |
| name: Build Container Image and Helm Chart | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Calculate tags | |
| id: tags | |
| shell: bash | |
| run: | | |
| echo "TAGS<<##" >> "$GITHUB_OUTPUT" | |
| ref=${{ github.ref }} | |
| case "$ref" in | |
| refs/heads/main) | |
| echo "latest" >> "$GITHUB_OUTPUT";; | |
| refs/tags/*) | |
| echo "${ref#refs/tags/}" >> "$GITHUB_OUTPUT";; | |
| *) | |
| echo "${{ github.sha }}" >> "$GITHUB_OUTPUT";; | |
| esac | |
| echo "##" >> "$GITHUB_OUTPUT" | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Configure Git | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Nodejs with yarn caching | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: '20' | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn | |
| - name: Parse Extension Name | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }} | |
| id: parsed-name | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ steps.tags.outputs.TAGS }} | |
| run: | | |
| yarn parse-tag-name ${{ env.RELEASE_TAG }} ${{ github.run_id }} "catalog" | |
| - name: Build and push UI image | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }} | |
| env: | |
| RELEASE_TAG: ${{ steps.tags.outputs.TAGS }} | |
| run: | | |
| publish=(yarn publish-pkgs -c -p -i '' -r ghcr.io -o 'suse') | |
| if [[ -n "${{ env.RELEASE_TAG }}" ]]; then | |
| publish+=(-t "$RELEASE_TAG") | |
| fi | |
| "${publish[@]}" | |
| - name: Re-checkout repository | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }} | |
| uses: actions/checkout@v4 | |
| - name: Package Helm Chart | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }} | |
| id: package | |
| run: | | |
| chart_package=$(helm package $CHART_PATH --destination . | awk '{print $NF}') | |
| echo "chart_package=$chart_package" >> $GITHUB_OUTPUT | |
| - name: Publish Helm Chart | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'suse-ai-lifecycle-manager-') }} | |
| run: | | |
| helm push ${{ steps.package.outputs.chart_package }} \ | |
| $CHART_REGISTRY |