Skip to content

Commit

Permalink
Merge pull request #108 from JsDaddy/feat/update-version
Browse files Browse the repository at this point in the history
Feat/update version
  • Loading branch information
NepipenkoIgor authored Mar 19, 2024
2 parents 615724d + b838241 commit 9cc60ae
Show file tree
Hide file tree
Showing 20 changed files with 21,037 additions and 16,973 deletions.
19 changes: 19 additions & 0 deletions .github/.hooks/pre-commit/quality.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin

set -e

npm run lint

output=$(npm run type-coverage)
if echo "$output" | grep -q "lower than "; then
echo "$output"
exit 1 # Terminate the hook script with a non-zero exit code
else
echo "Type coverage is good! 🎉"
fi

npm run test

npm run build

npm run build:lib
83 changes: 78 additions & 5 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,90 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
- name: Build demo
node-version: 20

- name: Install deps
run: |
npm ci --force
git submodule update --init --recursive --remote
git submodule update --init --recursive --remote
- name: Semantic Release
id: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
- name: Build demo app
env:
RELEASE_VERSION: ${{ steps.semantic-release.outputs.new-release-version }}
run: |
echo '********'
echo "RELEASE_VERSION: $RELEASE_VERSION"
echo '********'
bash .github/workflows/scripts/replace_template.sh $RELEASE_VERSION
npm run build
- name: Deploy demo
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist/ngx-copypaste/browser
outputs:
version: ${{ steps.semantic-release.outputs.new-release-version }}

slack_notification:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'deployments'
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Project: `${{ github.event.repository.name }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Version: `${{ needs.build.outputs.version || 'TBA' }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Commit/PR URL: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Website URL: ${{ secrets.WEBSITE_URL || 'TBA' }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/scripts/quality.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin

set -e

npm run lint

output=$(npm run type-coverage)
if echo "$output" | grep -q "lower than "; then
echo "$output"
exit 1 # Terminate the hook script with a non-zero exit code
else
echo "Type coverage is good! 🎉"
fi

npm run test

npm run build

npm run build:lib
15 changes: 15 additions & 0 deletions .github/workflows/scripts/replace_template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Check if the correct number of arguments are provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
exit 1
fi

# Assign arguments to variables
custom_string="$1"

# Perform the replacement and save to output file
sed "s/<%version%>/$custom_string/g" "angular.json" > "angular.json.tmp" && mv "angular.json.tmp" "angular.json"

echo "Template string replaced successfully. 🎉"
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-commit

This file was deleted.

7 changes: 7 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
branches:
- develop

plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/github'
- 'semantic-release-export-data'
11 changes: 7 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"options": {
"outputPath": "dist/ngx-copypaste",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"index": "src/index.html",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
Expand All @@ -43,6 +40,9 @@
},
"configurations": {
"production": {
"define": {
"VERSION": "'<%version%>'"
},
"optimization": true,
"sourceMap": false,
"namedChunks": false,
Expand All @@ -55,7 +55,7 @@
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumWarning": "9kb",
"maximumError": "10kb"
}
],
Expand All @@ -67,6 +67,9 @@
]
},
"development": {
"define": {
"VERSION": "'v0.0.1'"
},
"optimization": false,
"extractLicenses": false,
"sourceMap": true
Expand Down
Loading

0 comments on commit 9cc60ae

Please sign in to comment.