From c37d331647ab5a763360de20e5cf8eff5929af45 Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:37:49 -0800 Subject: [PATCH] Clean up github actions ci --- .github/workflows/ci.yml | 33 +++++++++------------------------ .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcb9239..9ec7121 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,9 @@ name: CI on: push: + branches: [ main ] pull_request: - release: - types: - - published + workflow_call: jobs: test: @@ -23,37 +22,23 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - runs-on: ubuntu-latest strategy: matrix: version: - elixir: 1.15 otp: 26.0 - deploy: true + runs-on: ubuntu-latest name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}} + env: + MIX_ENV: test + POSTGRES_URL: ecto://postgres:postgres@localhost/idempotency_plug_test steps: - uses: actions/checkout@v2 - uses: erlef/setup-beam@v1 with: otp-version: ${{matrix.version.otp}} elixir-version: ${{matrix.version.elixir}} - - run: mix deps.get + - run: mix deps.get mix compile --warnings-as-errors - run: mix test - env: - POSTGRES_URL: ecto://postgres:postgres@localhost/idempotency_plug_test - - run: MIX_ENV=test mix credo - 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 credo + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2139e0a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish + +on: + release: + types: + - published + +jobs: + test: + uses: ./.github/workflows/ci.yml + + publish: + needs: test + 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.14 + - run: mix deps.get + - run: mix hex.publish --yes \ No newline at end of file