Skip to content

Commit

Permalink
Adiciona automação de Release para o Octopost (#272)
Browse files Browse the repository at this point in the history
* chore: add release pipeline

* chore: add release pipeline (#1)

* chore: update package-json script

* chore: update changeset

* chore: enter pre-release mode

* chore: update main pipeline to frozen lockfile

* chore: update package json to remove electron builder

* chore: improve main pipeline to use pnpm cache

* chore: update npmrc to auto install peers

* docs: update CONTRIUTING.md
  • Loading branch information
alvarogfn authored Dec 15, 2023
1 parent 8ec51b8 commit 2d49b4b
Show file tree
Hide file tree
Showing 10 changed files with 871 additions and 194 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "devhatt/octopost" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@octopost/core": "0.1.0"
},
"changesets": []
}
5 changes: 5 additions & 0 deletions .changeset/tough-trainers-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@octopost/core': patch
---

add a release pipeline and change the name of octopost to @octopost/core
32 changes: 25 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,44 @@ on:
pull_request:
branches: ['master', 'develop']

env:
STORE_PATH: .pnpm-store
NODE_VERSION: 18.18.2

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Get PNPM store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup PNPM cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Code checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: pnpm install
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
branches:
- master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest

permissions:
contents: write # to create release
issues: write # to post issue comments
pull-requests: write # to create pull request

strategy:
matrix:
node-version: [18.x]

steps:
- name: Code Checkout
uses: actions/checkout@v3

- name: Package Manager
uses: pnpm/action-setup@v2
with:
version: 8

- name: Configuring Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Set NPM Token
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
version: pnpm version-packages
title: '[BUMP] Lançar uma release para o octopost!'
commit: 'chore: bump packages version'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52 changes: 51 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
## PNPM related ###############
## https://pnpm.io/npmrc #
###############################

# Not always possible to be strict, but if it works for you, keep it to true.
# https://pnpm.io/next/npmrc#strict-peer-dependencies
strict-peer-dependencies=false

# https://pnpm.io/npmrc#auto-install-peers
auto-install-peers=true

# Helps locating duplicates, default in v8
# https://pnpm.io/next/npmrc#use-lockfile-v6
use-lockfile-v6=true

# Will fix duplicates due to peer-dependencies (>=7.29.0), default in v8
# https://github.com/pnpm/pnpm/releases/tag/v7.29.0
dedupe-peer-dependents=true

# Helps with peer-deps (>=7.23.0), default in v8
# https://pnpm.io/npmrc#resolve-peers-from-workspace-root
resolve-peers-from-workspace-root=true

# default to 'lowest' in v8.5.0
# set to highest for reasons specified here: https://github.com/pnpm/pnpm/issues/6463
# https://pnpm.io/npmrc#resolution-mode
resolution-mode=highest

# Default in 8.1.0 to fix issues with root/workspaces hoisting
# https://pnpm.io/npmrc#dedupe-direct-deps
dedupe-direct-deps=false

# Pinlock to exact version (default is '^')
# https://pnpm.io/npmrc#save-prefix
# see also how save-workspace-protocol affect this https://pnpm.io/npmrc#save-workspace-protocol
save-prefix=''

# Most of the time, you want to use the rolling protocol for monorepos
# https://pnpm.io/npmrc#save-workspace-protocol
save-workspace-protocol=rolling

# Specifies which exact Node.js version should be used for the project's runtime.
# pnpm will automatically install the specified version of Node.js and use it
# for running pnpm run commands or the pnpm node command.
# https://pnpm.io/npmrc#save-workspace-protocol
use-node-version=18.18.2
node-version=18.18.0

# Prevent contributors of your project from adding new incompatible dependencies
# This way, even if someone is using Node.js v16, they will not be able to install
# a new dependency that doesn't support Node.js v18.18.2.
# https://pnpm.io/npmrc#use-node-version
node-version=18.18.2
engine-strict=true
40 changes: 22 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,48 @@ Bem-vindo ao Octopost! Agradecemos pelo seu interesse em contribuir para este pr
1. **Forquilhando o Repositório:** Faça um fork deste repositório para sua própria conta GitHub clicando no botão "Fork".
2. **Clonando o Repositório:** Clone o fork do repositório para a sua máquina local:

```bash
git clone <https://github.com/Alecell/octopost.git>
```bash
git clone <https://github.com/devhatt/octopost.git>
cd octopost

```
```

3. **Pegue uma Issue:** Para instruções mais detalhadas, acesse **[Pegando uma Issue](https://github.com/Alecell/octopost/blob/master/FLOWISSUE.md/)**.


4. **Crie uma Branch:** Crie uma branch a partir da develop para trabalhar nas suas alterações:

```bash
```bash
git checkout develop
git reset --hard upstream/develop
git checkout -b nome-da-sua-branch

```
git checkout -b issue-[numero-da-issue]
```

5. **Faça Alterações:** Faça as alterações desejadas no código, documentação, ou outros recursos.
6. **Código:** Siga o Style guide [octopost/STYLEGUIDE.md at master · Alecell/octopost (github.com)](https://github.com/Alecell/octopost/blob/master/STYLEGUIDE.md)
7. **Testes:** Certifique-se de que todas as mudanças são testadas e não introduzem erros.
8. **Commits Significativos:** Faça commits significativos e com mensagens claras. Utilizando comando abaixo e seguindo as instruções o commit ficara no padrão utilizado no projeto.
8. **Commits Significativos:** Faça commits significativos utilizando o [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) e com mensagens claras. Utilizando comando abaixo e seguindo as instruções o commit ficara no padrão utilizado no projeto.

```bash
git commit
git commit -m "<type>: <description>"
```

1. **Atualize a Documentação:** Se necessário, atualize a documentação relevante para refletir suas mudanças.
2. **Envie as Alterações:** Envie suas alterações para o seu fork:

```bash
git push origin nome-da-sua-branch
```bash
git push origin issue-[numero-da-issue]
```

3. **Criação de Pull Request (PR):** Abra um Pull Request pelo o seu fork para o repositorio do octopost na branch master, descrevendo suas alterações e fornecendo contexto sobre o que foi feito.
4. **Gerando novas Releases:** Após abrir o seu PR, você deve utilizar o comando `pnpm changeset` para gerar um arquivo de atualização selecionando se a sua alteração é `major`, `minor` ou `patch` e documentar as alterações no arquivo `.md` gerado.

```bash
pnpm changeset
```

```
> O arquivo markdown será gerado na pasta .changeset com um nome aleatório. Cuidado para não alterar os arquivos de documentação de outras pull requests.
3. **Criação de Pull Request (PR):** Abra um Pull Request pelo o seu fork para o repositorio do octopost na branch develop, descrevendo suas alterações e fornecendo contexto sobre o que foi feito.
4. **Revisão de Código:** A equipe de mantenedores do projeto irá revisar o seu PR. Esteja disposto a fazer ajustes se necessário.
5. **Merge e Fechamento:** Após a revisão bem-sucedida, suas alterações serão mescladas à branch principal. Seu PR será fechado.
1. **Revisão de Código:** A equipe de mantenedores do projeto irá revisar o seu PR. Esteja disposto a fazer ajustes se necessário.
2. **Merge e Fechamento:** Após a revisão bem-sucedida, suas alterações serão mescladas à branch principal. Seu PR será fechado.

## Gerando Builds do Electron para Windows do Linux

Expand All @@ -68,4 +72,4 @@ sudo apt-get install wine32

Agradecemos por ajudar a melhorar o Octopost! Sua dedicação à qualidade e inovação é fundamental para o sucesso contínuo deste projeto.

Se você tiver alguma dúvida ou precisar de ajuda em qualquer etapa do processo de contribuição, sinta-se à vontade para criar um problema (issue) ou entrar em contato com a equipe de mantenedores.[Discord](discord.gg/fhutDfuDa9)
Se você tiver alguma dúvida ou precisar de ajuda em qualquer etapa do processo de contribuição, sinta-se à vontade para criar um problema (issue) ou entrar em contato com a equipe de mantenedores.[Discord](discord.gg/fhutDfuDa9)
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "octopost",
"name": "@octopost/core",
"version": "0.1.0",
"engines": {
"node": "18.18.2",
Expand Down Expand Up @@ -27,9 +27,13 @@
"code-style": "concurrently \"pnpm lint\" \"pnpm stylelint\" \"pnpm prettier\"",
"ladle": "ladle serve",
"test-ct": "playwright test -c playwright-ct.config.ts",
"commit": "git-cz"
"commit": "git-cz",
"changeset": "changeset",
"version-packages": "changeset version",
"release": "pnpm build && changeset publish"
},
"dependencies": {
"@changesets/cli": "^2.27.1",
"@sentry/react": "^7.81.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"classnames": "^2.3.2",
Expand All @@ -51,6 +55,7 @@
"vite-tsconfig-paths": "^4.2.1"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@commitlint/cz-commitlint": "^18.4.3",
Expand Down Expand Up @@ -85,7 +90,7 @@
"stylelint": "^15.11.0",
"stylelint-config-sass-guidelines": "^10.0.0",
"stylelint-order": "^6.0.3",
"typescript": "^5.3.2",
"typescript": "5.2.2",
"typescript-plugin-css-modules": "^5.0.2",
"vite-plugin-electron": "^0.15.4",
"vite-plugin-native": "^0.2.0",
Expand Down
Loading

0 comments on commit 2d49b4b

Please sign in to comment.