From e4923c03bdc14fb49e69c9f5a8fe19ac6880fa5f Mon Sep 17 00:00:00 2001 From: Brayan batista zuniga Date: Thu, 14 Mar 2024 18:18:02 -0500 Subject: [PATCH] fix: running with multiple jobs --- .github/workflows/template-main.yml | 55 ++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/.github/workflows/template-main.yml b/.github/workflows/template-main.yml index 10b8d78..430c010 100644 --- a/.github/workflows/template-main.yml +++ b/.github/workflows/template-main.yml @@ -11,7 +11,7 @@ permissions: id-token: write jobs: - release: + Set Up: environment: ACTIONS_ENV runs-on: ubuntu-latest @@ -41,12 +41,19 @@ jobs: with: elixir-version: '1.14.3' otp-version: '25' - - - name: setup semantic-release + + - name: Setup semantic-release if: ${{ env.SKIP_RELEASE == 'false' }} run: npm install -g semantic-release @semantic-release/changelog @semantic-release/github conventional-changelog-eslint conventional-changelog-conventionalcommits conventional-changelog-angular -D - - - name: release + + Generate Release: + environment: ACTIONS_ENV + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Generate Release if: ${{ env.SKIP_RELEASE == 'false' }} run: npx -p conventional-changelog-eslint -p conventional-changelog-conventionalcommits -p @semantic-release/changelog semantic-release @@ -71,24 +78,21 @@ jobs: echo "$VER" echo "RELEASE_VERSION=$(git tag | sort --version-sort | tail -n1 | tr -d 'v')" >> $GITHUB_ENV - - name: Install Mix dependencies - if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }} - run: mix deps.get && mix deps.compile - working-directory: Elixir/Konex - - - name: Run Mix tests - if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }} - run: mix test - working-directory: Elixir/Konex + Commit and Push: + environment: ACTIONS_ENV + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + # testing, working but we need to prevent next run. + # adding [skip ci] to commit comment we can skip the new CI run onf the workflow + # not working on multiple commits from pull request - name: Upgrade mix.exs if: ${{ env.SKIP_RELEASE == 'false' && env.COMMIT_PUSH == 'true' }} run: sed -i 's/@version \".*\"/@version "${{ env.RELEASE_VERSION }}"/g' mix.exs working-directory: Elixir/Konex - # testing, working but we need to prevent next run. - # adding [skip ci] to commit comment we can skip the new CI run onf the workflow - # not working on multiple commits from pull request - name: Commit And Push version if: ${{ env.SKIP_RELEASE == 'false' && env.COMMIT_PUSH == 'true' }} uses: github-actions-x/commit@v2.9 @@ -101,6 +105,23 @@ jobs: name: Release Bot email: bbatist@bancolombia.com.co + Publish: + environment: ACTIONS_ENV + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Mix dependencies + if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }} + run: mix deps.get && mix deps.compile + working-directory: Elixir/Konex + + - name: Run Mix tests + if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }} + run: mix test + working-directory: Elixir/Konex + - name: Publish to HEX if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }} run: mix hex.publish --replace --yes