Skip to content

Commit

Permalink
[change] separate CI and CD workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zoten committed Sep 15, 2023
1 parent 7fc1de0 commit 9a8303a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 40 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CD

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 25.0.4
elixir-version: 1.14.3
- name: Checkout
uses: actions/checkout@v3
- name: setup hex
run: |
mix mix local.hex --force
mix local.rebar --force
- name: get deps
run: mix deps.get
- name: get tag
run: |
REDACT_EX_VERSION_REPO=$(grep -m1 version mix.exs | cut -d'"' -f2)
echo "REDACT_EX_VERSION_REPO=$REDACT_EX_VERSION_REPO" >> $GITHUB_ENV
- name: check tags
if: github.ref_tag != ${{ env.REDACT_EX_VERSION_REPO }}
run: |
echo "Github ref tag [${{ github.ref_tag }}] is different from mix.exs version [${{ env.REDACT_EX_VERSION_REPO }}]"
exit 1
- name: Login to hex.pm
run: |
mix hex.config api_key "$HEX_AUTH_KEY"
env:
HEX_AUTH_KEY: ${{ secrets.HEX_AUTH_KEY }}
- name: Publish
run: mix hex.publish --yes
40 changes: 0 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:

jobs:
test:
# runs-on: [self-hosted, k8s-medium]
runs-on: ubuntu-latest
env:
MIX_ENV: test
Expand Down Expand Up @@ -72,49 +71,10 @@ jobs:
- name: Dialyzer
run: mix dialyzer

publish:
name: Publish to hex.pm
needs: test
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Setup Elixir
uses: erlef/setup-beam@v1
# TODO optimize here to be in sync with the matrix above?
with:
otp-version: 25.0.4
elixir-version: 1.14.3
- name: Checkout
uses: actions/checkout@v3
- name: setup hex
run: |
mix mix local.hex --force
mix local.rebar --force
- name: get deps
run: mix deps.get
- name: get tag
run: |
REDACT_EX_VERSION_REPO=$(grep -m1 version mix.exs | cut -d'"' -f2)
echo "REDACT_EX_VERSION_REPO=$REDACT_EX_VERSION_REPO" >> $GITHUB_ENV
- name: check tags
if: github.ref_tag != ${{ env.REDACT_EX_VERSION_REPO }}
run: |
echo "Github ref tag [${{ github.ref_tag }}] is different from mix.exs version [${{ env.REDACT_EX_VERSION_REPO }}]"
exit 1
- name: Login to hex.pm
run: |
mix hex.config api_key "$HEX_AUTH_KEY"
env:
HEX_AUTH_KEY: ${{ secrets.HEX_AUTH_KEY }}
- name: Publish
run: mix hex.publish --yes

alls-green:
if: always()
needs:
- test
- publish
# runs-on: [self-hosted, k8s-small]
runs-on: ubuntu-latest
container:
image: public.ecr.aws/prima/python:3.9.10-3
Expand Down

0 comments on commit 9a8303a

Please sign in to comment.