Skip to content

Commit

Permalink
Merge pull request #3 from rafavschneider/feature/ci
Browse files Browse the repository at this point in the history
feat(ci): created GitHub Actions CI
  • Loading branch information
rafavschneider authored Apr 7, 2024
2 parents 2940abf + 4343b84 commit 5fbf508
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- main

jobs:
build-and-push:
name: 'Build and Push'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate sha
id: generate_sha
run: |
SHA=$(echo $GITHUB_SHA | head -c7)
echo "sha=$SHA >> $GITHUB_OUTPUT"
- name: Build docker image
run: docker build -t rafaelvschneider/nlw.service.passin:${{ steps.generate_sha.outputs.sha }} .

- name: Log into the container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push iamge
run: |
docker push rafaelvschneider/nlw.service.passin:${{ steps.generate_sha.outputs.sha }}
docker tag rafaelvschneider/nlw.service.passin:${{ steps.generate_sha.outputs.sha }} rafaelvschneider/nlw.service.passin:latest
docker push rafaelvschneider/nlw.service.passin:latest

0 comments on commit 5fbf508

Please sign in to comment.