Delete Lerna, Init Vitest and Add Husky #1246
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: Main CI | |
on: | |
push: | |
branches: ["main", "2.*"] | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: github.event.head_commit.author.name != 'github-actions[bot]' | |
environment: demo | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- run: yarn | |
- run: yarn --cwd drama-queen install | |
- run: yarn --cwd drama-queen run format:check | |
- run: yarn --cwd drama-queen run lint | |
- run: yarn test --watch=false | |
- run: yarn build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: drama | |
path: drama-queen/dist | |
check_if_version_upgraded: | |
needs: build | |
runs-on: ubuntu-latest | |
if: | | |
github.event_name == 'push' || | |
github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login | |
outputs: | |
is_upgraded_version: ${{ steps.check.outputs.changed }} | |
version: ${{ steps.check.outputs.version }} | |
type: ${{ steps.check.outputs.type }} | |
is_drama_upgraded_version: ${{ steps.check-drama.outputs.changed }} | |
drama_version: ${{ steps.check-drama.outputs.version }} | |
drama_type: ${{ steps.check-drama.outputs.type }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- name: Check if container version has been updated | |
id: check | |
uses: EndBug/version-check@v2 | |
- name: Check if drama queen version has been updated | |
id: check-drama | |
uses: EndBug/version-check@v2 | |
with: | |
file-name: drama-queen/package.json | |
docker_drama: | |
needs: check_if_version_upgraded | |
if: | | |
(needs.check_if_version_upgraded.outputs.is_drama_upgraded_version == 'true') | |
&& ( | |
github.event_name == 'push' || | |
needs.check_if_version_upgraded.outputs.drama_type == 'prerelease' | |
) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: drama | |
path: drama-queen/dist | |
- uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: drama-queen | |
push: true | |
tags: | | |
inseefr/drama-queen:latest, | |
inseefr/drama-queen:${{ needs.check_if_version_upgraded.outputs.drama_version }} | |
release: | |
runs-on: ubuntu-latest | |
needs: check_if_version_upgraded | |
if: | | |
needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && | |
( | |
github.event_name == 'push' || | |
needs.check_if_version_upgraded.outputs.type == 'prerelease' | |
) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: softprops/action-gh-release@v2 | |
with: | |
name: Release v${{ needs.check_if_version_upgraded.outputs.version }} | |
tag_name: v${{ needs.check_if_version_upgraded.outputs.version }} | |
target_commitish: ${{ github.head_ref || github.ref }} | |
generate_release_notes: true | |
draft: false | |
prerelease: ${{ needs.check_if_version_upgraded.outputs.type == 'prerelease' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |