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

[Feature]: Add deployment #3

Merged
merged 4 commits into from
Aug 19, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/development-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
dependencies:
name: Install Dependencies Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/dependencies-workflow.yml
uses: ./.github/workflows/dependencies-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -26,7 +26,7 @@ jobs:

linting:
name: Linting Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/linting-workflow.yml
uses: ./.github/workflows/linting-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -43,7 +43,7 @@ jobs:

test:
name: Testing Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/unit-test-workflow.yml
uses: ./.github/workflows/unit-test-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -60,7 +60,7 @@ jobs:

analysis:
name: Analyse Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/static-code-analysis-workflow.yml
uses: ./.github/workflows/static-code-analysis-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
dependencies:
name: Install Dependencies Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/dependencies-workflow.yml
uses: ./.github/workflows/dependencies-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -26,7 +26,7 @@ jobs:

linting:
name: Linting Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/linting-workflow.yml
uses: ./.github/workflows/linting-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -43,7 +43,7 @@ jobs:

test:
name: Testing Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/unit-test-workflow.yml
uses: ./.github/workflows/unit-test-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand All @@ -60,7 +60,7 @@ jobs:

analysis:
name: Analyse Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/static-code-analysis-workflow.yml
uses: ./.github/workflows/static-code-analysis-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/publish-to-hex-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: publish to hex
run-name: Publish to Hex - ${{ github.event.pull_request.title || github.event.head_commit.message || github.ref }}

on:
workflow_call:
inputs:
elixir:
required: true
type: string
otp:
required: true
type: string
os:
type: string
default: ubuntu-latest
environment:
required: true
type: string
environment_url:
required: true
type: string

jobs:
publish:
name: Publish to Hex Elixir ${{ inputs.elixir }} OTP ${{ inputs.otp }} - ${{ inputs.os }}
environment:
name: ${{ inputs.environment }}
url: ${{ inputs.environment_url }}
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v3

- name: Setup Elixir
uses: erlef/setup-beam@v1.16.0
with:
otp-version: ${{ inputs.otp }}
elixir-version: ${{ inputs.elixir }}

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

- name: Fetch and compile dependencies
run: |
mix deps.get
mix deps.compile

- name: Publish to Hex
run: mix hex.publish --yes
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
95 changes: 95 additions & 0 deletions .github/workflows/publish-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: publish
run-name: Publish - ${{ github.event.head_commit.message || github.ref }}

on:
push:
tags:
- v*

jobs:
dependencies:
name: Install Dependencies Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/dependencies-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}

strategy:
matrix:
elixir: [1.14.3]
otp: [25.3]
os: [ubuntu-latest]

linting:
name: Linting Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/linting-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}

needs:
- dependencies

strategy:
matrix:
elixir: [1.14.3]
otp: [25.3]
os: [ubuntu-latest]

test:
name: Testing Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/unit-test-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}

needs:
- dependencies

strategy:
matrix:
elixir: [1.14.3]
otp: [25.3]
os: [ubuntu-latest]

analysis:
name: Analyse Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/static-code-analysis-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}

needs:
- dependencies

strategy:
matrix:
elixir: [1.14.3]
otp: [25.3]
os: [ubuntu-latest]

publish:
name: Publish Elixir ${{ matrix.elixir }} OTP ${{ matrix.otp }} - ${{ matrix.os }}
uses: ./.github/workflows/publish-to-hex-reusable.yml
with:
elixir: ${{ matrix.elixir }}
otp: ${{ matrix.otp }}
os: ${{ matrix.os }}
environment: production
environment_url: https://hex.pm/packages/deepl_ex

needs:
- dependencies
- linting
- test
- analysis

strategy:
matrix:
elixir: [1.14.3]
otp: [25.3]
os: [ubuntu-latest]
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## v0.1.0 (2023-08-17)

* Initial release
* Add `translate/3` function
* Update license to `Apache-2.0` to match the common licenses found in the Elixir ecosystem
Loading