-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ajuste para probar pasar enviroment en job como variable de ento…
…rno, validar mensaje ultimo commit, prueba obtener enviroment de secrets
- Loading branch information
1 parent
b9df050
commit 756aeb1
Showing
1 changed file
with
86 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,19 @@ env: | |
|
||
jobs: | ||
release: | ||
environment: ${{ env.ACTIONS_ENV }} | ||
- name: Validate variables | ||
if: ${{ env.DEBUG_MODE == 'true' }} | ||
run: | | ||
echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}" | ||
- name: Validate commit message | ||
if: ${{ env.DEBUG_MODE == 'true' }} | ||
run: | | ||
echo "message1: ${{ github.event.head_commit.message }}" | ||
echo "message2: ${{ github.event.workflow_run.head_commit.message }}" | ||
echo "message3: ${{ github.event.commits[0].message }}" | ||
environment: ${{env.ACTIONS_ENV}} | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
|
@@ -31,86 +43,87 @@ jobs: | |
DEBUG_MODE: ${{ vars.DEBUG_MODE }} | ||
COMMIT_PUSH: ${{ vars.COMMIT_PUSH }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Validate commit message | ||
if: ${{ env.DEBUG_MODE == 'true' }} | ||
run: | | ||
echo "message1: ${{ github.event.head_commit.message }}" | ||
echo "message2: ${{ github.event.workflow_run.head_commit.message }}" | ||
echo "message3: ${{ github.event.commits[0].message }}" | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
# - name: Setup Node.js | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20.x | ||
|
||
- name: Set up Elixir 1.14.3 and Otp 25 | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: '1.14.3' | ||
otp-version: '25' | ||
# - name: Set up Elixir 1.14.3 and Otp 25 | ||
# uses: erlef/setup-beam@v1 | ||
# with: | ||
# elixir-version: '1.14.3' | ||
# otp-version: '25' | ||
|
||
- name: setup semantic-release | ||
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 | ||
# run: npm install -g semantic-release @semantic-release/changelog @semantic-release/github conventional-changelog-eslint conventional-changelog-conventionalcommits conventional-changelog-angular -D | ||
|
||
- name: release | ||
run: npx -p conventional-changelog-eslint -p conventional-changelog-conventionalcommits -p @semantic-release/changelog semantic-release | ||
# - name: release | ||
# run: npx -p conventional-changelog-eslint -p conventional-changelog-conventionalcommits -p @semantic-release/changelog semantic-release | ||
|
||
- name: Validate variables | ||
if: ${{ env.DEBUG_MODE == 'true' }} | ||
run: | | ||
echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}" | ||
echo "CONDITION RELEASE_VERSION != '';=${{ env.RELEASE_VERSION != '' }}" | ||
echo "CONDITION PUBLISH_ARTIFACT == '';=${{ env.RELEASE_VERSION == '' }}" | ||
echo "CONDITION PUBLISH_ARTIFACT == TRUE;=${{ env.PUBLISH_ARTIFACT == 'true' }}" | ||
echo "CONDITION PUBLISH_ARTIFACT == FALSE;=${{ env.PUBLISH_ARTIFACT == 'false' }}" | ||
echo "GITHUB_API_URL=${{ env.GITHUB_API_URL }}" | ||
echo "PUBLISH_ARTIFACT=${{ env.PUBLISH_ARTIFACT }}" | ||
echo "COMMIT_PUSH=${{ env.COMMIT_PUSH }}" | ||
echo "DEBUG_MODE=${{ env.DEBUG_MODE }}" | ||
# - name: Validate variables | ||
# if: ${{ env.DEBUG_MODE == 'true' }} | ||
# run: | | ||
# echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}" | ||
# echo "CONDITION RELEASE_VERSION != '';=${{ env.RELEASE_VERSION != '' }}" | ||
# echo "CONDITION PUBLISH_ARTIFACT == '';=${{ env.RELEASE_VERSION == '' }}" | ||
# echo "CONDITION PUBLISH_ARTIFACT == TRUE;=${{ env.PUBLISH_ARTIFACT == 'true' }}" | ||
# echo "CONDITION PUBLISH_ARTIFACT == FALSE;=${{ env.PUBLISH_ARTIFACT == 'false' }}" | ||
# echo "GITHUB_API_URL=${{ env.GITHUB_API_URL }}" | ||
# echo "PUBLISH_ARTIFACT=${{ env.PUBLISH_ARTIFACT }}" | ||
# echo "COMMIT_PUSH=${{ env.COMMIT_PUSH }}" | ||
# echo "DEBUG_MODE=${{ env.DEBUG_MODE }}" | ||
|
||
- name: Validate docs | ||
if: ${{ env.DEBUG_MODE == 'true' }} | ||
run: | | ||
ls -l | ||
ls -l docs | ||
- name: Set variables From git tag command | ||
if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) || ( env.COMMIT_PUSH == 'true' ) }} | ||
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.PUBLISH_ARTIFACT == 'true' ) || ( env.COMMIT_PUSH == 'true' ) }} | ||
# run: | | ||
# echo "$VER" | ||
# echo "RELEASE_VERSION=$(git tag | sort --version-sort | tail -n1 | tr -d 'v')" >> $GITHUB_ENV | ||
|
||
- name: Install Mix dependencies | ||
if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) || ( env.COMMIT_PUSH == 'true' ) }} | ||
run: mix deps.get && mix deps.compile | ||
working-directory: Elixir/Konex | ||
env: | ||
SKIP_GIT_HOOKS: 'true' | ||
# - name: Install Mix dependencies | ||
# if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) }} | ||
# run: mix deps.get && mix deps.compile | ||
# working-directory: Elixir/Konex | ||
# env: | ||
# SKIP_GIT_HOOKS: 'true' | ||
|
||
- name: Run Mix tests | ||
if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) || ( env.COMMIT_PUSH == 'true' ) }} | ||
run: mix test | ||
working-directory: Elixir/Konex | ||
# - name: Run Mix tests | ||
# if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) }} | ||
# run: mix test | ||
# working-directory: Elixir/Konex | ||
|
||
- name: Upgrade mix.exs | ||
if: ${{ ( env.COMMIT_PUSH == 'true' ) }} | ||
run: sed -i 's/@version \".*\"/@version "${{ env.RELEASE_VERSION }}"/g' mix.exs | ||
working-directory: Elixir/Konex | ||
# - name: Upgrade mix.exs | ||
# if: ${{ ( 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 | ||
- name: Commit And Push version | ||
if: ${{ ( env.COMMIT_PUSH == 'true' ) }} | ||
uses: github-actions-x/[email protected] | ||
with: | ||
github-token: ${{ env.GITHUB_TOKEN }} | ||
push-branch: main | ||
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] | ||
# # 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.COMMIT_PUSH == 'true' ) }} | ||
# uses: github-actions-x/[email protected] | ||
# with: | ||
# github-token: ${{ env.GITHUB_TOKEN }} | ||
# push-branch: main | ||
# 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: Publish to HEX | ||
if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) }} | ||
run: mix hex.publish --replace --yes | ||
working-directory: Elixir/Konex | ||
env: | ||
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | ||
# - name: Publish to HEX | ||
# if: ${{ ( env.PUBLISH_ARTIFACT == 'true' ) }} | ||
# run: mix hex.publish --replace --yes | ||
# working-directory: Elixir/Konex | ||
# env: | ||
# HEX_API_KEY: ${{ secrets.HEX_API_KEY }} |