Skip to content

Commit

Permalink
fix: running with multiple jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatist-ban committed Mar 14, 2024
1 parent 268be3a commit e4923c0
Showing 1 changed file with 38 additions and 17 deletions.
55 changes: 38 additions & 17 deletions .github/workflows/template-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
id-token: write

jobs:
release:
Set Up:
environment: ACTIONS_ENV
runs-on: ubuntu-latest

Expand Down Expand Up @@ -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

Expand All @@ -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/[email protected]
Expand All @@ -101,6 +105,23 @@ jobs:
name: Release Bot
email: [email protected]

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
Expand Down

0 comments on commit e4923c0

Please sign in to comment.