Skip to content

Commit

Permalink
test: testing creation file 11
Browse files Browse the repository at this point in the history
  • Loading branch information
braybatista authored Apr 1, 2024
1 parent 0210608 commit 457443b
Showing 1 changed file with 59 additions and 58 deletions.
117 changes: 59 additions & 58 deletions .github/workflows/template-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,49 @@ jobs:
OTP_VERSION: ${{ vars.OTP_VERSION }}
SKIP_GIT_HOOKS: 'true'
SKIP_RELEASE: ${{ contains(github.event.head_commit.message, '[skip release]') || contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[release skip]') || contains(github.event.head_commit.message, '[ci skip]') }}

GITHUB_BRANCH: ${GITHUB_REF#refs/*/}

steps:
- uses: actions/checkout@v4

- name: Create A File
if: ${{ env.SKIP_RELEASE == 'false' }}
run: echo '{"repositoryUrl":"https://github.com/bancolombia/opensource-innersource-toolkit.git","branches":["main"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"eslint","releaseRules":[{"tag":"breaking","release":"major"},{"tag":"feat","release":"minor"},{"tag":"chore","release":"minor"},{"tag":"refactor","release":"minor"},{"tag":"update","release":"minor"},{"tag":"upgrade","release":"minor"},{"tag":"docs","release":"patch"},{"tag":"ci","release":"patch"},{"tag":"fix","release":"patch"},{"tag":"test","release":"patch"},{"tag":"perf","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"breaking","section":"Major version release","hidden":false},{"type":"BREAKING","section":"Major version release","hidden":false},{"type":"BREAKING CHANGE","section":"Major version release","hidden":false},{"type":"BREAKING CHANGES","section":"Major version release","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"update","section":"Updates","hidden":false},{"type":"upgrade","section":"Upgrades","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"chore","section":"Chores","hidden":false},{"type":"ci","section":"CI/CD Changes","hidden":false},{"type":"test","section":"Tests","hidden":false},{"type":"refactor","section":"Refactoring","hidden":false},{"type":"perf","section":"Performance Improvements","hidden":false}]},"writerOpts":{"commitsSort":["subject","scope"]}}],"@semantic-release/github",["@semantic-release/changelog",{"changelogFile":"docs/CHANGELOG.md"}]]}' > .releaserc2
run: echo '{"repositoryUrl":"https://github.com/bancolombia/opensource-innersource-toolkit.git","branches":["${GITHUB_REF#refs/*/}"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"eslint","releaseRules":[{"tag":"breaking","release":"major"},{"tag":"feat","release":"minor"},{"tag":"chore","release":"minor"},{"tag":"refactor","release":"minor"},{"tag":"update","release":"minor"},{"tag":"upgrade","release":"minor"},{"tag":"docs","release":"patch"},{"tag":"ci","release":"patch"},{"tag":"fix","release":"patch"},{"tag":"test","release":"patch"},{"tag":"perf","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"breaking","section":"Major version release","hidden":false},{"type":"BREAKING","section":"Major version release","hidden":false},{"type":"BREAKING CHANGE","section":"Major version release","hidden":false},{"type":"BREAKING CHANGES","section":"Major version release","hidden":false},{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"update","section":"Updates","hidden":false},{"type":"upgrade","section":"Upgrades","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"chore","section":"Chores","hidden":false},{"type":"ci","section":"CI/CD Changes","hidden":false},{"type":"test","section":"Tests","hidden":false},{"type":"refactor","section":"Refactoring","hidden":false},{"type":"perf","section":"Performance Improvements","hidden":false}]},"writerOpts":{"commitsSort":["subject","scope"]}}],"@semantic-release/github",["@semantic-release/changelog",{"changelogFile":"docs/CHANGELOG.md"}]]}' > .releaserc2

- name: Set Actual Branch
if: ${{ env.SKIP_RELEASE == 'false' }}
id: vars
run: |
echo "GITHUB_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "output_test=$(cat .releaserc2)" >> $GITHUB_OUTPUT
echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
#echo "GITHUB_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "file_content=$(cat .releaserc2)" >> $GITHUB_OUTPUT
echo ::set-output name=actual_branch::${GITHUB_REF#refs/*/}
- name: Setup Node.js
if: ${{ env.SKIP_RELEASE == 'false' }}
uses: actions/setup-node@v4
with:
node-version: 20.x
# - name: Setup Node.js
# if: ${{ env.SKIP_RELEASE == 'false' }}
# uses: actions/setup-node@v4
# with:
# node-version: 20.x

- name: Set up Elixir 1.14.3 and Otp 25
if: ${{ env.SKIP_RELEASE == 'false' }}
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
# - name: Set up Elixir 1.14.3 and Otp 25
# if: ${{ env.SKIP_RELEASE == 'false' }}
# uses: erlef/setup-beam@v1
# with:
# elixir-version: ${{ env.ELIXIR_VERSION }}
# otp-version: ${{ env.OTP_VERSION }}

- 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: 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
if: ${{ env.SKIP_RELEASE == 'false' }}
run: npx -p conventional-changelog-eslint -p conventional-changelog-conventionalcommits -p @semantic-release/changelog semantic-release
# - name: Release
# if: ${{ env.SKIP_RELEASE == 'false' }}
# run: npx -p conventional-changelog-eslint -p conventional-changelog-conventionalcommits -p @semantic-release/changelog semantic-release

- name: Set variables From git tag command
if: ${{ env.SKIP_RELEASE == 'false' }}
run: |
echo "$VER"
echo "RELEASE_VERSION=$(git tag | sort --version-sort | tail -n1 | tr -d 'v')" >> $GITHUB_ENV
# - name: Set variables From git tag command
# if: ${{ env.SKIP_RELEASE == 'false' }}
# run: |
# echo "$VER"
# echo "RELEASE_VERSION=$(git tag | sort --version-sort | tail -n1 | tr -d 'v')" >> $GITHUB_ENV

- name: Validate variables
if: ${{ env.SKIP_RELEASE == 'false' && env.DEBUG_MODE == 'true' }}
Expand All @@ -85,39 +86,39 @@ jobs:
echo "COMMIT_LAST_MESSAGE: ${{ github.event.head_commit.message }}"
echo "SKIP_RELEASE: ${{ env.SKIP_RELEASE }}"
echo "GITHUB_BRANCH: ${{ env.GITHUB_BRANCH }}"
echo ${{ steps.vars.outputs.output_test }}
echo ${{ steps.vars.outputs.short_ref }}
echo ${{ steps.vars.outputs.file_content }}
echo ${{ steps.vars.outputs.actual_branch }}
# COMMIT_PUSH steps
- 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
# # COMMIT_PUSH steps
# - 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

- name: Commit And Push version
if: ${{ env.SKIP_RELEASE == 'false' && env.COMMIT_PUSH == 'true' }}
uses: github-actions-x/[email protected]
with:
github-token: ${{ env.GITHUB_TOKEN }}
push-branch: ${{ env.GITHUB_BRANCH }}
commit-message: '[skip release] [skip ci] Upgrade version to ${{ env.RELEASE_VERSION }}'
force-add: "true"
files: Elixir/Konex/mix.exs docs/CHANGELOG.md
name: Release Bot
email: [email protected]
# - name: Commit And Push version
# if: ${{ env.SKIP_RELEASE == 'false' && env.COMMIT_PUSH == 'true' }}
# uses: github-actions-x/[email protected]
# with:
# github-token: ${{ env.GITHUB_TOKEN }}
# push-branch: ${{ env.GITHUB_BRANCH }}
# commit-message: '[skip release] [skip ci] Upgrade version to ${{ env.RELEASE_VERSION }}'
# force-add: "true"
# files: Elixir/Konex/mix.exs docs/CHANGELOG.md
# name: Release Bot
# email: [email protected]

# PUBLISH_ARTIFACT steps
- name: Install Mix dependencies
if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }}
run: mix deps.get && mix deps.compile
working-directory: Elixir/Konex
# # PUBLISH_ARTIFACT steps
# - 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: 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
working-directory: Elixir/Konex
# - name: Publish to HEX
# if: ${{ env.SKIP_RELEASE == 'false' && env.PUBLISH_ARTIFACT == 'true' }}
# run: mix hex.publish --replace --yes
# working-directory: Elixir/Konex

0 comments on commit 457443b

Please sign in to comment.