Skip to content

Commit

Permalink
v3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DoneDeal0 committed Aug 21, 2024
1 parent fd57132 commit d9bf098
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 25 deletions.
64 changes: 40 additions & 24 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
Expand All @@ -41,45 +41,61 @@ jobs:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
# create a current_version variable that can be used in the next steps
outputs:
current_version: ${{ steps.version_check.outputs.current_version }}

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm install

- name: Build Talkr
run: npm run build
# fetch the latest release tag and compare it to the current package.json version
# publish if the version has been bumped
# if there is no tag (first release), the previous version is set to "none" and the publish step continues
- name: Check if package version has been bumped
id: version_check
run: |
current_version=$(jq -r '.version' package.json)
echo "current_version=$current_version" >> $GITHUB_ENV
git fetch --tags
previous_version=$(git tag --sort=-v:refname | head -n 1 || echo "none")
echo "previous_version=$previous_version" >> $GITHUB_ENV
if [ "$previous_version" != "none" ] && [ "$previous_version" == "v$current_version" ]; then
echo "Version has not been bumped. Exiting."
exit 1
fi
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const coreInfo = require('@actions/core');
const { execSync } = require('child_process');
// Read the current version from package.json
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const currentVersion = packageJson.version;
// Fetch the latest tags
execSync('git fetch --tags');
// Get the latest tag
let allTags = execSync('git tag -l --sort=v:refname').toString().trim().split('\n')
let previousVersion = allTags[0];
if (!previousVersion) {
previousVersion = 'none';
} else {
previousVersion = previousVersion.replace(/^v/, ''); // Remove the 'v' prefix if present
}
// Check if the version has been bumped
if (previousVersion === currentVersion || currentVersion === '') {
console.log('Version has not been bumped. Exiting.');
process.exit(1);
}
// Set outputs for the next steps
coreInfo.setOutput('current_version', currentVersion);
- name: Log current version
run: echo "The current version is ${{ steps.version_check.outputs.current_version }}"

- name: Publish to npm
if: ${{ steps.version_check.outputs.current_version != '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public

- name: Create GitHub Release
Expand Down
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/DoneDeal0/Talkr"
"url": "git+https://github.com/DoneDeal0/Talkr.git"
},
"keywords": [
"i18n",
Expand All @@ -40,6 +40,7 @@
"author": "DoneDeal0",
"license": "ISC",
"devDependencies": {
"@actions/core": "^1.10.1",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@eslint/js": "^9.9.0",
Expand Down
38 changes: 38 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
# yarn lockfile v1


"@actions/core@^1.10.1":
version "1.10.1"
resolved "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz"
integrity sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==
dependencies:
"@actions/http-client" "^2.0.1"
uuid "^8.3.2"

"@actions/http-client@^2.0.1":
version "2.2.2"
resolved "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.2.tgz"
integrity sha512-2TvX5LskKQzDDQI+bobIDGAjkn0NJiQlg4MTrKnZ8HfQ7nDEUbtJ1ytxPDb2bfk3Hr2XD99X8oAJISAmIoiSAQ==
dependencies:
tunnel "^0.0.6"
undici "^5.25.4"

"@adobe/css-tools@^4.4.0":
version "4.4.0"
resolved "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz"
Expand Down Expand Up @@ -1061,6 +1077,11 @@
resolved "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz"
integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==

"@fastify/busboy@^2.0.0":
version "2.1.1"
resolved "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz"
integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==

"@humanwhocodes/module-importer@^1.0.1":
version "1.0.1"
resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz"
Expand Down Expand Up @@ -5068,6 +5089,11 @@ tslib@^2.4.0:
resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz"
integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==

tunnel@^0.0.6:
version "0.0.6"
resolved "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==

type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz"
Expand Down Expand Up @@ -5160,6 +5186,13 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

undici@^5.25.4:
version "5.28.4"
resolved "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz"
integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==
dependencies:
"@fastify/busboy" "^2.0.0"

unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz"
Expand Down Expand Up @@ -5216,6 +5249,11 @@ url-parse@^1.5.3:
querystringify "^2.1.1"
requires-port "^1.0.0"

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

v8-to-istanbul@^9.0.1:
version "9.3.0"
resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz"
Expand Down

0 comments on commit d9bf098

Please sign in to comment.