Skip to content

Commit

Permalink
feat(gh): creating workflows
Browse files Browse the repository at this point in the history
kallebysantos committed Jan 21, 2025

Verified

This commit was signed with the committer’s verified signature.
kallebysantos Kalleby Santos
1 parent 4797d7a commit 0867d19
Showing 2 changed files with 73 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
name: Build and test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup elixir
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: 27.x # Define the OTP version [required]
elixir-version: 1.17.x # Define the elixir version [required]

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

- name: Install dependencies
run: mix deps.get
- name: Run tests
run: mix test
40 changes: 40 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: publish Docker image

on:
release:
types: [ "published" ]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: kallebysantos/ocrlot

- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 0867d19

Please sign in to comment.