Skip to content

Commit

Permalink
Merge pull request #88 from dxfrontier/singular-entity
Browse files Browse the repository at this point in the history
Singular entity
  • Loading branch information
dragolea authored Sep 4, 2024
2 parents 50f90a5 + 7f8e0ca commit 2fb5a4f
Show file tree
Hide file tree
Showing 9 changed files with 556 additions and 358 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Deployment

on:
pull_request:
branches:
- dev
types:
- closed

permissions:
contents: write
pull-requests: write

jobs:
# This job will check if the Pull request was merged into dev branch
check_valid_merge:
name: Merge 'Pull request' to 'dev' branch
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- run: |
echo The PR was merged.
# This will validate to see if the labels contains 'none' which means that if 'none' was found the release will not happen
check_valid_deploy:
name: Validate deploy conditions
needs: check_valid_merge
if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }}
runs-on: ubuntu-latest
steps:
- run: |
echo The PR can continue to deploy the version.
# This will start build of the project
check_valid_build:
name: Check build validity
runs-on: ubuntu-latest
needs: [check_valid_deploy]
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm run build

# This will push the latest build of the project to npm
publish-npm:
name: Publish to npm public
needs: check_valid_build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-npm-github:
name: Publish to github npm - internal
needs: check_valid_build
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm ci
- run: npm run build
- run: |
echo @dxfrontier:registry=https://npm.pkg.github.com/ > ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
- run: npm publish
74 changes: 8 additions & 66 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@ name: Release
on:
pull_request:
branches:
- main
- dev
types:
- closed
paths-ignore:
- '../../test/*'
- '../ISSUE_TEMPLATE/*'
- '../workflows/*'

permissions:
contents: write
pull-requests: write

jobs:
# This job will check if the Pull request was merged into main branch
# This job will check if the Pull request was merged into dev branch
check_valid_merge:
name: Merge 'Pull request' to 'main' branch
name: Merge 'Pull request' to 'dev' branch
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
Expand All @@ -37,21 +33,11 @@ jobs:
- run: |
echo The PR can continue to tags release creation.
# This will start build of the project
check_valid_build:
name: Check build validity
runs-on: ubuntu-latest
needs: [check_valid_merge, check_valid_release]
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm run build

# Steps for creation of the tags
create_tags:
name: Generate and push tags
runs-on: ubuntu-latest
needs: check_valid_build
needs: [check_valid_merge, check_valid_release]
permissions:
contents: write

Expand All @@ -73,7 +59,7 @@ jobs:
CUSTOM_TAG: ${{ steps.package-version.outputs.current-version}}
BRANCH_HISTORY: full

# This create_changelog_partial will create the CHANGELOG only for the latest tag and create the RELEASE
# Create of the changelog file and commit the file to the dev branch
create_changelog_partial:
name: Generate changelog, create PR for CHANGELOG.md
needs: create_tags
Expand Down Expand Up @@ -110,7 +96,6 @@ jobs:
draft: false
make_latest: true

# This create_changelog_full will create the CHANGELOG.md
create_changelog_full:
name: Generate changelog, create PR for CHANGELOG.md
needs: create_tags
Expand All @@ -135,60 +120,17 @@ jobs:

- name: Move CHANGELOG.md generated file to root folder
run: |
cp ./git-cliff/CHANGELOG.md ./
cp ./git-cliff/CHANGELOG.md ./
rm ./git-cliff/CHANGELOG.md
rmdir ./git-cliff/
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
base: main
base: dev
token: ${{ secrets.GITHUB_TOKEN }}
title: CHANGELOG.md updated
body: CHANGELOG.md updated with latest conventional commits.
labels: norelease
labels: norelease, deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


# This will push the latest build of the project to npm
publish-npm:
name: Publish to npm public
needs: [create_changelog_full, create_changelog_partial]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- run: npm install
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-npm-github:
name: Publish to github npm - internal
needs: [create_changelog_full, create_changelog_partial]
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm ci
- run: npm run build
- run: |
echo @dxfrontier:registry=https://npm.pkg.github.com/ > ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
- run: npm publish
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ name: Test
on:
pull_request:
types: [opened, edited, synchronize]
paths-ignore:
- '../../README.md'
- '../ISSUE_TEMPLATE'
- '../workflows'

workflow_dispatch:

Expand Down
Loading

0 comments on commit 2fb5a4f

Please sign in to comment.