{"id":23810383,"url":"https://github.com/zingarelli/github-actions","last_synced_at":"2026-04-29T16:02:12.712Z","repository":{"id":263046866,"uuid":"889178614","full_name":"zingarelli/github-actions","owner":"zingarelli","description":"Configurando as primeiras actions para garantia de CI/CD","archived":false,"fork":false,"pushed_at":"2024-11-19T20:52:44.000Z","size":272,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T18:17:08.876Z","etag":null,"topics":["aprendinaalura","ci-cd","github-actions","vercel"],"latest_commit_sha":null,"homepage":"https://github-actions-khaki.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zingarelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-15T19:06:16.000Z","updated_at":"2024-11-19T20:52:47.000Z","dependencies_parsed_at":"2024-11-15T20:33:26.912Z","dependency_job_id":null,"html_url":"https://github.com/zingarelli/github-actions","commit_stats":null,"previous_names":["zingarelli/github-actions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zingarelli/github-actions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingarelli%2Fgithub-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingarelli%2Fgithub-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingarelli%2Fgithub-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingarelli%2Fgithub-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zingarelli","download_url":"https://codeload.github.com/zingarelli/github-actions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zingarelli%2Fgithub-actions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aprendinaalura","ci-cd","github-actions","vercel"],"created_at":"2025-01-02T00:14:18.700Z","updated_at":"2026-04-29T16:02:12.684Z","avatar_url":"https://github.com/zingarelli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![SVG depicting the steps involving a CI/CD process in an infinite cycle: plan, code, build, continuous testing, release, deploy, operate, monitor. ](./public/cicd.svg)\n\n# CI/CD e GitHub Actions\n\n🎓 Curso: [NextJS: CI e CD para Front-end com o Github Actions](https://cursos.alura.com.br/course/nextjs-ci-cd-front-end-github-actions)\n\n🗒️ [Events that trigger workflows](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows)\n\n🙏 [Créditos da imagem](https://www.blackduck.com/glossary/what-is-cicd.html)\n\n## Definição\n\n- CI (Continuous Integration): está relacionado às etapas de commit, build e testes da aplicação, ou seja, tarefas do dia a dia do dev;\n\n- CD (Continuous Delivery): está relacionado às etapas de release e deploy, ou seja, às entregas do projeto.\n\nSão processos de automatização de um projeto.\n\n## Usando GitHub Actions para deploy na Vercel\n\nPara o CD usando a Vercel, são necessários alguns passos. O curso mostrou detalhadamente uma forma, mas já é antiga e algumas coisas mudaram. \n\nDeixo abaixo os links para referência (em inglês) de como é feito hoje em dia, e mais abaixo os scrips criados no `package.json` e o arquivo yml utilizado para o workflow:\n\n- [Criação do arquivo yml para o workflow](https://vercel.com/guides/how-can-i-use-github-actions-with-vercel)\n\n- [Criação do VERCEL_TOKEN](https://vercel.com/guides/how-do-i-use-a-vercel-api-access-token)\n\n- [Instalação da Vercel CLI](https://vercel.com/docs/cli): necessária para criar os tokens VERCEL_ORG_ID e VERCEL_PROJECT_ID.\n\n  - uma alternativa é usar o comando `npx vercel link` na pasta do projeto. Quando rodar a primeira vez, dois passos adicionais irão ocorrer: 1. Irá instalar o pacote da Vercel e 2. Irá logar na sua conta Vercel. Após isso, o comando irá rodar e fazer algumas perguntas para configuração do link (é como seu projeto local é linkado com o projeto hospedado na Vercel). Finalizado, será criada a pasta `.vercel` e dentro dela você encontrará o `projectId` e `orgId` no arquivo `project.json`. Essa pasta é automaticamente adicionada ao gitignore. **NÃO compartilhe essa pasta nem os valores dos tokens** para evitar acesso indevido ao seu projeto.\n\n- [Criação de secrets no GitHub](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository): é aqui que você vai guardar os tokens gerados.\n\n### Scripts package.json\n\n```json\n\"scripts\": {\n  \"dev\": \"next dev\",\n  \"build\": \"next build\",\n  \"start\": \"next start\",\n  \"lint\": \"next lint\",\n  \"lint:fix\": \"next lint --fix\",\n  \"deploy:prod\": \"npm run build \u0026\u0026 vercel --yes --prod --token=$VERCEL_TOKEN\"\n}\n```\n\n### Arquivo yml\n\n```yml\nname: 'CD: Main Workflow'\n\n# variáveis de ambiente \n# (salvas no GitHub secrets)\nenv:\n  VERCEL_TOKEN: '${{ secrets.VERCEL_TOKEN }}'\n  VERCEL_ORG_ID: '${{ secrets.VERCEL_ORG_ID }}'\n  VERCEL_PROJECT_ID: '${{ secrets.VERCEL_PROJECT_ID }}'\n\n# quando a action deve ser acionada\non:\n  push:\n    branches: [main, cd-vercel]\n\n# o que deve ser executado\njobs:\n  deploy: # nome deste job\n    runs-on: ubuntu-latest\n    # use - para indicar uma lista de passos\n    steps:      \n      - uses: actions/checkout@v3\n      - name: Run Install\n        run: npm install\n      - name: Run Deploy\n        run: npm run deploy:prod\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzingarelli%2Fgithub-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzingarelli%2Fgithub-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzingarelli%2Fgithub-actions/lists"}