-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff42b6e
commit 4052884
Showing
6 changed files
with
17 additions
and
274 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,43 +108,17 @@ jobs: | |
shell: bash | ||
# This step can be removed once the issue is fixed in the changeset package. | ||
run: npm install @changesets/[email protected] | ||
- if: steps.packagejson.outputs.exists == 'true' | ||
name: Get version update from the changeset | ||
uses: changesets/action@v1 | ||
with: | ||
version: npx -p @changesets/[email protected] changeset version | ||
|
||
- if: steps.packagejson.outputs.exists == 'true' | ||
name: Get version from package.json | ||
id: get-version | ||
run: echo ::set-output name=version::$(node -p "require('./package.json').version") | ||
|
||
- if: steps.packagejson.outputs.exists == 'true' | ||
name: Update version inside action.yml | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const templatePath = path.resolve('./', 'action-template.yml'); | ||
const outputPath = path.resolve('./', 'action.yml'); | ||
const templateContent = fs.readFileSync(templatePath, 'utf8'); | ||
const updatedContent = templateContent.replace(/\${ version }/g, '${{ steps.get-version.outputs.version }}'); | ||
fs.writeFileSync(outputPath, updatedContent, 'utf8'); | ||
console.log(`Updated action.yml with version ${{ steps.get-version.outputs.version }}`); | ||
|
||
- if: steps.packagejson.outputs.exists == 'true' | ||
name: Publish to any of NPM, Github, and Docker Hub | ||
#this step has 2 goals, it is either identifying that there is changeset file created and then this action creates a PR with version bump that will trigger release - or if it sees there is no changeset, and there are versions changes in package.json files, it publish new versions to NPM is they are not there yet | ||
uses: changesets/action@v1 | ||
id: release | ||
with: | ||
publish: npx -p @changesets/[email protected] changeset publish | ||
version: npm run update:version | ||
commit: "chore(release): release and bump versions of packages" | ||
title: "chore(release): release and bump versions of packages" | ||
publish: npx -p @changesets/[email protected] changeset publish | ||
setupGitUser: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
prepare: async (pluginConfig, context) => { | ||
const { nextRelease } = context; | ||
const version = nextRelease.version; | ||
function bumpActionVersion() { | ||
const packageJsonPath = path.join(__dirname, '../../', 'package.json'); | ||
const packageJsonVersion = require(packageJsonPath).version; | ||
|
||
const templatePath = path.resolve(__dirname, '../../', 'action-template.yml'); | ||
const outputPath = path.resolve(__dirname, '../../', 'action.yml'); | ||
const templatePath = path.join(__dirname, '../../', 'action-template.yml'); | ||
const outputPath = path.join(__dirname, '../../', 'action.yml'); | ||
|
||
try { | ||
const templateContent = fs.readFileSync(templatePath, 'utf8'); | ||
const updatedContent = templateContent.replace(/\${ version }/g, version); | ||
fs.writeFileSync(outputPath, updatedContent, 'utf8'); | ||
console.log(`Updated action.yml with version ${version}`); | ||
} catch (error) { | ||
console.error('Error updating action.yml:', error); | ||
throw error; | ||
} | ||
} | ||
}; | ||
const templateContent = fs.readFileSync(templatePath, 'utf8'); | ||
const updatedContent = templateContent.replace(/\${ version }/g, packageJsonVersion); | ||
|
||
fs.writeFileSync(outputPath, updatedContent, 'utf8'); | ||
console.log(`Updated action.yml with version ${packageJsonVersion}`); | ||
} | ||
|
||
bumpActionVersion(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,8 @@ | |
"repository": "asyncapi/cli", | ||
"scripts": { | ||
"build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && oclif manifest && echo \"Build Completed\"", | ||
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", | ||
"bump:github-action": "cd github-action/lib/ && node bump-action-version.js", | ||
"bump:version": "npx -p @changesets/[email protected] changeset version && npm run bump:github-action", | ||
"dev": "tsc --watch", | ||
"docker:build": "docker build -t asyncapi/cli:latest .", | ||
"generate:readme:create": "node -e \"const fs = require('fs'); fs.writeFileSync('scripts/README.md', '# Usage\\n\\n<!-- usage -->\\n\\n# Commands\\n\\n<!-- commands -->\\n');\"", | ||
|
@@ -169,7 +170,6 @@ | |
"createhook": "oclif generate hook myhook --event=command_not_found", | ||
"createhookinit": "oclif generate hook inithook --event=init", | ||
"action:docker:build": "docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .", | ||
"action:bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", | ||
"action:test": "cd github-action && make test" | ||
}, | ||
"types": "lib/index.d.ts" | ||
|