Update: [ELI-759] - adding repo check for regression test workflow (… #115
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: release workflow | |
| on: | |
| push: | |
| branches: [ main ] | |
| env: | |
| BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }} | |
| jobs: | |
| quality_checks: | |
| uses: ./.github/workflows/quality-checks.yml | |
| secrets: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| get_commit_id: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| commit_id: ${{ steps.commit_id.outputs.commit_id }} | |
| steps: | |
| - name: Get Commit ID | |
| id: commit_id | |
| run: | | |
| echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
| tag_release: | |
| needs: quality_checks | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| spec_version: ${{steps.output_version_tag.outputs.SPEC_VERSION}} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.BRANCH_NAME }} | |
| fetch-depth: 0 | |
| # using git commit sha for version of action to ensure we have stable version | |
| - name: Install asdf | |
| uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 | |
| with: | |
| asdf_version: 0.18.0 | |
| - name: Cache asdf | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.asdf | |
| key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} | |
| - name: Install asdf dependencies in .tool-versions | |
| uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47 | |
| with: | |
| asdf_version: 0.18.0 | |
| env: | |
| PYTHON_CONFIGURE_OPTS: --enable-shared | |
| - name: Cache Virtualenv | |
| uses: actions/cache@v5 | |
| id: cache-venv | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-venv-${{ hashFiles('pyproject.toml') }} | |
| - name: Install python packages | |
| if: steps.cache-venv.outputs.cache-hit != 'true' | |
| run: make install | |
| - name: Install node packages | |
| run: | | |
| make install-node | |
| - name: Set VERSION_TAG env var to be short git SHA and get next tag version | |
| id: output_version_tag | |
| run: | | |
| VERSION_TAG=$(git rev-parse --short HEAD) | |
| NEXT_VERSION=$(npx semantic-release --dry-run | grep -i 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') | |
| tagFormat=$(jq -r .tagFormat .releaserc) | |
| if [ "${tagFormat}" = "null" ] | |
| then | |
| tagFormat="v\${version}" | |
| fi | |
| # disabling shellcheck as replace does not work | |
| # shellcheck disable=SC2001 | |
| NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/") | |
| echo "## VERSION TAG: ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "## NEXT RELEASE WILL BE: ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT" | |
| echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Create next release | |
| id: output_next_release_notes | |
| run: | | |
| npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} |