Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only_publish_on_main #6

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Build & Publish
name: Build & Test

on:
pull_request:
push:
branches:
- "*"
branches-ignore:
- "main"

# by default, permissions are read-only, read + write is required for git pushes
permissions:
Expand Down Expand Up @@ -80,12 +82,3 @@ jobs:
if: matrix.check_formatted

- run: mix test --include integration

- name: Build & Publish
run: |
mix hex.build
mix hex.publish --yes
if: matrix.check_formatted
env:
MIX_ENV: dev
HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
70 changes: 70 additions & 0 deletions .github/workflows/ci_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build & Publish

on:
pull_request:
push:
branches:
- "main"

# by default, permissions are read-only, read + write is required for git pushes
permissions:
contents: write

env:
MIX_ENV: test

jobs:
test:
runs-on: "ubuntu-latest"

name: Test Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
elixir: ["1.16"]
otp: ["26"]
include:
- elixir: "1.16"
otp: "26"
check_formatted: true
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: erlef/setup-beam@v1
id: setup-elixir
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Restore Dependency Cache
uses: actions/cache@v3
id: cache-deps
with:
path: |
deps
_build
key: |
mix-${{ runner.os }}-${{matrix.elixir}}-${{matrix.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{matrix.elixir}}-${{matrix.otp}}-

- name: Install Mix Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- run: mix deps.compile --warnings-as-errors
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Build & Publish
run: |
mix hex.build
mix hex.publish --yes
if: matrix.check_formatted
env:
MIX_ENV: dev
HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
Loading