From 765231c1f76bc2f4cc3830c8d6e8360005d52734 Mon Sep 17 00:00:00 2001 From: anthony-nhs <121869075+anthony-nhs@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:04:05 +0000 Subject: [PATCH] Fix: [AEA-0000] - auto bump version on merge to main (#187) ## Summary - Routine Change ### Details - auto bump version on merge to main --- .github/workflows/ci.yml | 90 ----------------------------------- .github/workflows/release.yml | 3 +- 2 files changed, 2 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 7d46bb6c..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: merge to main workflow - -on: - push: - branches: [main] - -env: - BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }} - -jobs: - quality_checks: - uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/quality-checks.yml@v4.0.4 - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - get_commit_id: - runs-on: ubuntu-latest - 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-latest - outputs: - spec_version: ${{steps.output_version_tag.outputs.SPEC_VERSION}} - steps: - - name: Checkout code - uses: actions/checkout@v4 - 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@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 - with: - asdf_branch: v0.11.3 - - - name: Cache asdf - uses: actions/cache@v4 - with: - path: | - ~/.asdf - key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} - restore-keys: | - ${{ runner.os }}-asdf- - - - name: Install asdf dependencies in .tool-versions - uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 - with: - asdf_branch: v0.11.3 - env: - PYTHON_CONFIGURE_OPTS: --enable-shared - - - name: Install node packages - run: | - export PATH="/home/runner/.asdf/installs/poetry/1.3.1/bin:$PATH" - make install-node - - - name: Set VERSION_TAG env var to be short git SHA and get next tag varsion - 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 TAG 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: Output next release details - id: output_next_release_details - run: | - npx semantic-release --dry-run - env: - GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b32ce1a..25a4ab2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: release workflow on: - workflow_dispatch: + push: + branches: [main] env: BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}