Create Release Candidate from main #3
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: Create Release Candidate. | |
| run-name: Create Release Candidate from ${{ github.event.inputs.rc_commit_sha || 'main' }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| rc_commit_sha: | |
| description: 'Commit from which to create the release candidate. If not provided, the latest commit on main will be used' | |
| required: false | |
| type: string | |
| dry_run: | |
| description: 'Dry Run: If true, the pipeline will not publish the helm chart.' | |
| required: true | |
| default: 'true' | |
| type: choice | |
| options: | |
| - true | |
| - false | |
| jobs: | |
| create_patch_release: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| rc_branch: ${{ steps.create_release.outputs.rc_branch }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine commit from where to create the RC | |
| id: determine_commit | |
| run: | | |
| if [ -n "${{ github.event.inputs.rc_commit_sha }}" ]; then | |
| commit_sha="${{ github.event.inputs.rc_commit_sha }}" | |
| echo "Using provided commit sha: $commit_sha" | |
| echo "commit_sha=$commit_sha" >> $GITHUB_ENV | |
| else | |
| commit_sha=$(git rev-parse HEAD) | |
| echo "No commit sha provided, using the latest commit on main: $commit_sha" | |
| echo "commit_sha=$commit_sha" >> $GITHUB_ENV | |
| fi | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: | | |
| npm install standard-version | |
| - name: Create release candidate tag & branch | |
| id: create_release | |
| env: | |
| DRY_RUN: ${{ github.event.inputs.dry_run }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COMMIT_SHA: ${{ env.commit_sha }} | |
| BOT_EMAIL: ${{ vars.BOT_EMAIL }} | |
| BOT_USERNAME: ${{ vars.BOT_USERNAME }} | |
| run: | | |
| ci/scripts/create_rc.sh | |
| - name: Prepare chart | |
| env: | |
| BOT_EMAIL: ${{ vars.BOT_EMAIL }} | |
| BOT_USERNAME: ${{ vars.BOT_USERNAME }} | |
| id: prepare_chart | |
| run: | | |
| ci/scripts/prepare_chart_for_release.sh | |
| - name: Dry Run Outputs | |
| if: ${{ github.event.inputs.dry_run == 'true'}} | |
| run: | | |
| echo "This Pipeline was executed in dry run mode so it will not publish the helm chart." | |
| echo "Below are some useful data to check:" | |
| echo "Release candidate branch: $(git rev-parse --abbrev-ref HEAD)" | |
| echo "-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*" | |
| echo "Contents of: chart/apl/Chart.yaml" | |
| cat chart/apl/Chart.yaml | |
| echo "-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*" | |
| echo "Contents of: package.json" | |
| cat package.json | |
| echo "-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*" | |
| echo "Latest 5 commits on the release candidate branch" | |
| git log -n 5 --pretty=format:"%h %s" --abbrev-commit | |
| echo "-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*--*-*" | |
| echo "Commits behind main branch VS Commits ahead of main branch" | |
| git rev-list --left-right --count origin/main...HEAD | |
| - name: Create and publish otomi chart release | |
| if: ${{ github.event.inputs.dry_run == 'false' }} | |
| id: chart_release | |
| uses: helm/chart-releaser-action@v1.7.0 | |
| with: | |
| charts_dir: chart | |
| skip_existing: true | |
| mark_as_latest: false | |
| env: | |
| CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' |