From 48ef7ad7eed230394733efa3b224f087e3014845 Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Sun, 19 Nov 2023 15:55:20 -0800 Subject: [PATCH] Update GHA --- .github/workflows/{build.yml => ci.yml} | 45 +++++++++++++------------ .github/workflows/publish.yml | 25 ++++++++++++++ 2 files changed, 48 insertions(+), 22 deletions(-) rename .github/workflows/{build.yml => ci.yml} (63%) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 63% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index cf5850d..09f5b86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,27 @@ name: CI on: - push: + push: + branches: [ main ] pull_request: - release: - types: - - published + workflow_call: jobs: + lint: + runs-on: ubuntu-latest + name: Linter + env: + MIX_ENV: test + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: 26.0 + elixir-version: 1.15 + - run: mix deps.get + - run: mix compile --warnings-as-errors + - run: mix credo --strict + test: strategy: matrix: @@ -24,6 +38,9 @@ jobs: runs-on: ${{ matrix.version.os }} name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}} / ${{matrix.html_parser}} + env: + MIX_ENV: test + HTML_PARSER: ${{matrix.html_parser}} steps: - uses: actions/checkout@v2 - uses: erlef/setup-beam@v1 @@ -31,21 +48,5 @@ jobs: otp-version: ${{matrix.version.otp}} elixir-version: ${{matrix.version.elixir}} - run: mix deps.get - - run: MIX_ENV=test mix compile - - run: HTML_PARSER=${{matrix.html_parser}} mix test - - run: MIX_ENV=test mix credo --strict - deploy: - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' - name: Deploy published release - env: - HEX_API_KEY: ${{secrets.HEX_API_KEY}} - steps: - - uses: actions/checkout@v2 - - uses: erlef/setup-beam@v1 - with: - otp-version: 25.0 - elixir-version: 1.14 - - run: mix deps.get - - run: mix hex.publish --yes + - run: mix compile --warnings-as-errors + - run: mix test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6cf2992 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish + +on: + release: + types: + - published + +jobs: + ci: + uses: ./.github/workflows/ci.yml + + publish: + needs: ci + runs-on: ubuntu-latest + name: Publish release + env: + HEX_API_KEY: ${{secrets.HEX_API_KEY}} + steps: + - uses: actions/checkout@v2 + - uses: erlef/setup-beam@v1 + with: + otp-version: 26.0 + elixir-version: 1.15 + - run: mix deps.get + - run: mix hex.publish --yes