fix(release): Add semantic release #67
Workflow file for this run
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
name: Reactive Commons CI/RM | |
on: | |
push: | |
branches: | |
- main | |
- feature/* | |
- fix/* | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Semantic Release | |
- name: Verify Conventional Commits | |
uses: amannn/action-semantic-pull-request@v5 | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up NodeJS | |
if: github.ref == 'refs/heads/main' | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Set up Semantic Release | |
if: github.ref == 'refs/heads/main' | |
run: npm -g install @semantic-release/git [email protected] | |
- name: Semantic Release | |
if: github.ref == 'refs/heads/main' | |
run: npx [email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_P_A_TOKEN }} # debe crear un Personal Access Token | |
# Elixir | |
- name: Set up Elixir | |
uses: erlef/[email protected] | |
with: | |
version-type: strict | |
version-file: ".tool-versions" | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get && mix deps.compile | |
env: | |
MIX_ENV: test | |
SKIP_GIT_HOOKS: 'true' | |
- name: Static code analysis | |
run: mix format --check-formatted && mix sobelow && mix credo --strict && mix dialyzer | |
- name: Tests & Coverage (main) | |
if: github.ref == 'refs/heads/main' | |
run: mix coveralls.github | |
env: | |
CI_ENV: 'true' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Tests & Coverage (pull requests) | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
run: mix coveralls.lcov | |
env: | |
CI_ENV: 'true' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup PR Report tool | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- name: Validate code coverage | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
uses: zgosalvez/github-actions-report-lcov@v3 | |
with: | |
coverage-files: cover/lcov.info | |
minimum-coverage: 5 # TODO: Add minimum coverage | |
artifact-name: code-coverage-report | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
update-comment: true |