Skip to content

Move from master to main branch #97

Move from master to main branch

Move from master to main branch #97

Workflow file for this run

name: Actions CI
on: push
env:
CUATRO_HEX_KEY: ${{ secrets.HUMMINGBIRD_HEXPM_PUBLISH_KEY }}
jobs:
bless:
name: Bless
runs-on: ubuntu-latest
env:
MIX_ENV: test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore the deps cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-deps-${{ env.MIX_ENV }}
- name: Restore the _build cache
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}
- name: Determine the elixir version
run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV
- name: Determine the otp version
run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV
- name: Setup Elixir and Erlang versions
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Fetch mix dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Compile dependencies
run: mix deps.compile
- name: Compile
run: mix compile --warnings-as-errors --force
- name: Coveralls
run: mix coveralls
- name: Check formatting
run: mix format --check-formatted
- name: Credo
run: mix credo
- name: Generate documentation
run: mix docs
env:
MIX_ENV: dev
- name: Determine the tag version
env:
GITHUB_REF: ${{ github.ref }}
run: echo "TAG=$(echo "$GITHUB_REF" | awk -F / '{print $3}')" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Write tagged version to .library_version to ensure published
run: echo $TAG > .library_version
if: startsWith(github.ref, 'refs/tags/v')
- name: Determine the repository name
run: echo "REPOSITORY=$(echo $GITHUB_REPOSITORY | awk -F / '{print $2}')" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Publish library
# note, `--organization cuatro` is left off because we are publishing
# run: mix hex.publish --yes --organization cuatro
run: mix hex.publish --yes
if: startsWith(github.ref, 'refs/tags/v')
env:
MIX_ENV: dev
HEX_API_KEY: ${{ secrets.HEX_PUBLISH_KEY }}
- name: Notify ops channel of publish success
run: |
curl \
-X POST \
-H 'Content-type:application/json' \
-d "{\"text\":\"hex package published for $REPOSITORY $(git tag -ln $TAG)\"}" \
$SLACK_WEBHOOK
if: startsWith(github.ref, 'refs/tags/v')
env:
SLACK_WEBHOOK: ${{ secrets.OPS_CHANNEL_SLACK_WEBHOOK }}
# Generated by Elixir.Gaas.Generators.Simple.Actions.LibraryCi