Migrado para next 15, migrado para app router, migrado para login com… #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI CD Workflow | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Run test script | |
run: | | |
echo "$FUNCIONA_VARIAVEIS" | |
ls -lhas | |
echo "Nome da imagem weilplace-api" | |
echo "$IMG_WEILPLACE_API" | |
echo "Nome da imagem weilplace-site" | |
echo "$IMG_WEILPLACE_SITE" | |
echo "REF: ${{ github.ref }}" | |
- name: Set up environment | |
run: mv ./backend/.env.example ./backend/.env | |
- name: Install and run tests | |
run: | | |
cd ./backend | |
npm ci | |
npm run test | |
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up environment | |
run: | | |
mv ./backend/.env.example ./backend/.env | |
mv ./frontend/.env.production ./frontend/.env.local | |
- name: Extract metadata (tags, labels) for Docker | |
id: apimeta | |
uses: docker/metadata-action@v5 | |
with: | |
images: erickweil/weilplace-api | |
- name: Build and push (backend) | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./backend | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.apimeta.outputs.tags }} | |
labels: ${{ steps.apimeta.outputs.labels }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: sitemeta | |
uses: docker/metadata-action@v5 | |
with: | |
images: erickweil/weilplace-site | |
- name: Build and push (frontend) | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./frontend | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.sitemeta.outputs.tags }} | |
labels: ${{ steps.sitemeta.outputs.labels }} |