Skip to content

Commit

Permalink
feat(config): test stable release (#59)
Browse files Browse the repository at this point in the history
* fix(docs): rewrite prettier setup (#40)

* chore(docs): rewrite commitlint config (#47)

* fix(docs): update typescript config (#48)

* fix(docs): update Semantic Release config (#50)

* fix(docs): update Vitest config (#51)

* fix(docs): update Code Quality Workflow documentation (#52)

* fix(docs): update Vitest documentation

* fix(config): update Test action documentation (#53)

* feat(config): update writerside ci pipeline (#54)

* fix(config): update writerside ci pipeline (#55)

* fix(config): update writerside ci pipeline

* fix(config): update writerside documentation

* fix(config): release documentation (#56)

* feat(config): adds release workflow (#57)

* chore(config): checks legal checkboxes (#58)
  • Loading branch information
csantiago132 authored Oct 19, 2024
1 parent 6dfa0a9 commit 2f20329
Show file tree
Hide file tree
Showing 40 changed files with 1,751 additions and 310 deletions.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
src/vitest/setup.react.ts
src/vitest/vite.react.ts

node_modules
48 changes: 48 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Deploy'
description: 'Deploys the application to Fly.io for staging and production environments.'

inputs:
commit_sha:
description: 'Commit SHA for deployment'
required: true

runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '50'

- name: Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: 'fly.toml'
field: 'app'

- name: Setup Fly
uses: superfly/flyctl-actions/[email protected]

- name: Deploy Dev
if: ${{ github.ref == 'refs/heads/dev' }}
shell: bash
run: |
flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ inputs.commit_sha }} --app ${{ steps.app_name.outputs.value }}-staging
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: Deploy Production
if: ${{ github.ref == 'refs/heads/main' }}
shell: bash
run: |
flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ inputs.commit_sha }} --build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: Set Deployed Version
id: set_version
shell: bash
run: |
VERSION=$(jq -r .version package.json)
echo "deployed_version=${VERSION}" >> $GITHUB_OUTPUT
34 changes: 34 additions & 0 deletions .github/ci.cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI/CD Pipeline

on:
pull_request:
push:
branches:
- main

jobs:
lint:
uses: kurocado-studio/styleguide/.github/workflows/lint.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
needs: lint
uses: kurocado-studio/styleguide/.github/workflows/test.yml@main
secrets: inherit

document:
needs: test
uses: kurocado-studio/styleguide/.github/workflows/writerside-documentation@main
secrets: inherit

release:
needs: document
uses: kurocado-studio/styleguide/.github/workflows/release.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PAT_FORCE_PUSH: ${{ secrets.GITHUB_TOKEN }}
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
11 changes: 0 additions & 11 deletions .github/ci.documentation.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/ci.lint.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ci.release.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Deployment Pipeline

on:
pull_request:
types: [closed]
branches:
- main
- dev

jobs:
deploy:
if: github.event.pull_request.merged == true
uses: kurocado-studio/styleguide/.github/actions/deploy@main
with:
commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
secrets:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
29 changes: 17 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ name: Release Workflow
permissions:
pull-requests: write
contents: write
pages: write
id-token: write

on:
workflow_call:
inputs:
release-branch-prefix:
description: 'Prefix for the release branch name'
required: true
type: string
release-label:
description: 'Label to apply to the release pull request'
required: false
type: string
push:
branches:
- main
Expand All @@ -25,33 +33,30 @@ jobs:
- name: Install
uses: kurocado-studio/styleguide/.github/actions/install@main

- name: Lint
uses: kurocado-studio/styleguide/.github/actions/lint@main

- name: Test
uses: kurocado-studio/styleguide/.github/actions/test@main

- name: Build
run: pnpm run build

- name: Semantic Release
- name: Release
id: semantic_release
uses: semantic-release/action@v6
with:
args: --ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

- name: Create Release Branch
if: success() && steps.semantic_release.outputs.nextRelease
if: success() && steps.semantic_release.outputs.nextRelease != ''
run: |
VERSION=${{ steps.semantic_release.outputs.nextRelease.version }}
git checkout -b ${{ inputs.release-branch-prefix }}${VERSION}
- name: Push Release Branch
if: success() && steps.semantic_release.outputs.nextRelease
if: success() && steps.semantic_release.outputs.nextRelease != ''
env:
PAT: ${{ secrets.PAT_FORCE_PUSH }}
run: |
VERSION=${{ steps.semantic_release.outputs.nextRelease.version }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${PAT}@github.com/${{ github.repository }}.git
Expand All @@ -70,7 +75,7 @@ jobs:
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
- name: Create Pull Request to Main
if: success() && steps.semantic_release.outputs.nextRelease
if: success() && steps.semantic_release.outputs.nextRelease != ''
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
pull_request:
push:
branches:
- canary
- main

jobs:
code-quality:
Expand All @@ -24,8 +24,5 @@ jobs:
- name: Install Dependencies
uses: kurocado-studio/styleguide/.github/actions/install@main

- name: Lint
uses: kurocado-studio/styleguide/.github/actions/lint@main

- name: Test
uses: kurocado-studio/styleguide/.github/actions/test@main
12 changes: 10 additions & 2 deletions .github/workflows/writerside-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- main
paths:
- 'Writerside/**'

permissions:
contents: write
Expand All @@ -19,6 +21,10 @@ env:
jobs:
build-and-deploy-docs:
runs-on: ubuntu-latest
if: |
github.event_name != 'workflow_call' ||
(github.event_name == 'workflow_call' &&
contains(steps.check_changes.outputs.changed_paths, 'Writerside/'))
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -29,8 +35,10 @@ jobs:
- name: Install Dependencies
uses: kurocado-studio/styleguide/.github/actions/install@main

- name: Lint
uses: kurocado-studio/styleguide/.github/actions/lint@main
- name: Check for changes in Writerside directory
id: check_changes
run: |
echo "::set-output name=changed_paths::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^Writerside/')"
- name: Build docs using Writerside Docker builder
uses: JetBrains/writerside-github-action@v4
Expand Down
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing

Thanks for your willingness to contribute! Please make sure to check with us before doing a bunch of
work on something.

## Before Contributing

**[See contributing @ Kurocado Studio](https://kurocado-studio.github.io/styleguide/contributing.html)**

## Project setup

If you do need to set the project up locally yourself, feel free to follow these instructions:

### System Requirements

- [Node.js](https://nodejs.org/) >= 20.0.0
- [npm](https://npmjs.com/) >= 8.18.0
- [git](https://git-scm.com/) >= 2.38.0

### Setup steps

- Fork repo
- clone the repo
- Run `npm install` to install dependencies and run validation
- Create a branch for your PR with `git checkout -b pr/your-branch-name`
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Kurocado Studio Style Guide

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://kurocado-studio.github.io/styleguide/contributing.html)

A comprehensive style guide based on Vercel's style guide, enabling developers to set up
repositories quickly with consistent code quality and best practices.

Expand Down
33 changes: 33 additions & 0 deletions Writerside/codeSnippets/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI/CD Pipeline

on:
pull_request:
push:
branches:
- main

jobs:
lint:
uses: kurocado-studio/styleguide/.github/workflows/lint.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

document:
needs: lint
uses: kurocado-studio/styleguide/.github/workflows/writerside-documentation@main
secrets: inherit

test:
uses: kurocado-studio/styleguide/.github/workflows/test.yml@main
secrets: inherit

release:
needs: documentation
uses: kurocado-studio/styleguide/.github/workflows/release.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PAT_FORCE_PUSH: ${{ secrets.PAT_FORCE_PUSH }}
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
8 changes: 8 additions & 0 deletions Writerside/dcs.tree
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
<toc-element topic="Guides.md">
<toc-element topic="How-To-Install-Prettier.md"/>
<toc-element topic="How-To-Install-ESLint.md"/>
<toc-element topic="How-To-Install-Commitlint.md"/>
<toc-element topic="How-To-Install-Typescript.md"/>
<toc-element topic="How-To-Install-Semantic-Release.md"/>
<toc-element topic="How-To-Install-Vitest.md"/>
</toc-element>
<toc-element topic="Github-Actions.md">
<toc-element topic="Code-Quality.md"/>
<toc-element topic="Test-Workflow.md"/>
<toc-element topic="Release.md"/>
<toc-element topic="Writerside.md"/>
<toc-element topic="Deploy-Workflow.md"/>
</toc-element>
<toc-element topic="CODE-OF-CONDUCT.md"/>
<toc-element topic="CONTRIBUTING.md"/>
</instance-profile>
Loading

0 comments on commit 2f20329

Please sign in to comment.