Skip to content

Commit

Permalink
chore: update workflows and branches
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Jan 15, 2024
1 parent 98179bf commit f9cca62
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 12 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/npm_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Manual NPM publish

on:
workflow_dispatch:
inputs:
version_tag:
description: 'Version tag'
required: true

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.5.0'
registry-url: 'https://registry.npmjs.org/'

- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.version_tag }}

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

- name: NPM publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
14 changes: 7 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Release
on:
push:
branches:
# - main
# - develop
- main
- develop
- alpha
workflow_dispatch:

Expand All @@ -13,16 +13,16 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.5.0'

- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Dependencies
run: npm ci

Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/update_dependent_projects_alpha.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,51 @@
name: Update dependent projects (ALPHA)
name: Update dependent projects (alpha)

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name'
required: false
prerelease:
description: 'Prerelease'
required: false
default: 'false'

env:
LIBRARY_NAME: "gisce/react-formiga-components"

jobs:
update-dependents:
if: github.event.release.prerelease == true && contains(github.event.release.tag_name, '-alpha.') && !contains(github.event.release.tag_name, '-rc.')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- project: "gisce/react-ooui"
branch: "alpha"
steps:
- name: Set environment variables and check condition
run: |
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
PRERELEASE="${{ github.event.release.prerelease || github.event.inputs.prerelease }}"
if [ "$PRERELEASE" == "true" ] && [[ "$TAG_NAME" != *'-rc.'* ]] && [[ "$TAG_NAME" == *'-alpha.'* ]]; then
SHOULD_RUN="true"
else
SHOULD_RUN="false"
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
echo "SHOULD_RUN=$SHOULD_RUN" >> $GITHUB_ENV
- name: Check Prerelease and Tag Version
if: env.SHOULD_RUN == 'true'
run: echo "Running update for tag ${{ env.TAG_NAME }}"
- name: Call Reusable Workflow for each project
if: env.SHOULD_RUN == 'true'
uses: gisce/create-update-version-pr@v0.0.5
with:
dependentProject: ${{ matrix.project }}
tagName: ${{ github.event.release.tag_name }}
tagName: ${{ env.TAG_NAME }}
dependentProjectBranch: ${{ matrix.branch }}
libraryName: ${{ env.LIBRARY_NAME }}
githubToken: ${{ secrets.GH_PAT }}
51 changes: 51 additions & 0 deletions .github/workflows/update_dependent_projects_v2-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update dependent projects (v2-develop)

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name'
required: false
prerelease:
description: 'Prerelease'
required: false
default: 'false'

env:
LIBRARY_NAME: "gisce/react-formiga-components"

jobs:
update-dependents:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- project: "gisce/react-ooui"
branch: "v2-develop"
steps:
- name: Set environment variables and check condition
run: |
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
PRERELEASE="${{ github.event.release.prerelease || github.event.inputs.prerelease }}"
if [ "$PRERELEASE" == "true" ] && [[ "$TAG_NAME" == *'-rc.'* ]] && [[ "$TAG_NAME" != *'-alpha.'* ]]; then
SHOULD_RUN="true"
else
SHOULD_RUN="false"
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
echo "SHOULD_RUN=$SHOULD_RUN" >> $GITHUB_ENV
- name: Check Prerelease and Tag Version
if: env.SHOULD_RUN == 'true'
run: echo "Running update for tag ${{ env.TAG_NAME }}"
- name: Call Reusable Workflow for each project
if: env.SHOULD_RUN == 'true'
uses: gisce/create-update-version-pr@v0.0.5
with:
dependentProject: ${{ matrix.project }}
tagName: ${{ env.TAG_NAME }}
dependentProjectBranch: ${{ matrix.branch }}
libraryName: ${{ env.LIBRARY_NAME }}
githubToken: ${{ secrets.GH_PAT }}
51 changes: 51 additions & 0 deletions .github/workflows/update_dependent_projects_v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update dependent projects (v2)

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name'
required: false
prerelease:
description: 'Prerelease'
required: false
default: 'false'

env:
LIBRARY_NAME: "gisce/react-formiga-components"

jobs:
update-dependents:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- project: "gisce/react-ooui"
branch: "v2"
steps:
- name: Set environment variables and check condition
run: |
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
PRERELEASE="${{ github.event.release.prerelease || github.event.inputs.prerelease }}"
if [ "$PRERELEASE" != "true" ] then
SHOULD_RUN="true"
else
SHOULD_RUN="false"
fi
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
echo "SHOULD_RUN=$SHOULD_RUN" >> $GITHUB_ENV
- name: Check Prerelease and Tag Version
if: env.SHOULD_RUN == 'true'
run: echo "Running update for tag ${{ env.TAG_NAME }}"
- name: Call Reusable Workflow for each project
if: env.SHOULD_RUN == 'true'
uses: gisce/create-update-version-pr@v0.0.5
with:
dependentProject: ${{ matrix.project }}
tagName: ${{ env.TAG_NAME }}
dependentProjectBranch: ${{ matrix.branch }}
libraryName: ${{ env.LIBRARY_NAME }}
githubToken: ${{ secrets.GH_PAT }}
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx tsc --noEmit -p tsconfig.build.json
npx lint-staged
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"react-dom": "18.2.0"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint --max-warnings=0 --no-ignore",
"src/**/*.{js,jsx,ts,tsx}": "eslint",
"src/**/*.{js,jsx,ts,tsx,json,css,md}": "prettier --write"
},
"release": {
Expand Down

0 comments on commit f9cca62

Please sign in to comment.