-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new plugin for semantic release of project
- Loading branch information
1 parent
8f4bd9e
commit 19fab83
Showing
4 changed files
with
65 additions
and
58 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ on: | |
- published | ||
|
||
jobs: | ||
|
||
publish-docker: | ||
name: Generating Docker | ||
runs-on: ubuntu-latest | ||
|
@@ -56,3 +55,45 @@ jobs: | |
pass: ${{ secrets.DOCKER_PASSWORD }} | ||
slug: asyncapi/cli | ||
description: CLI to work with your AsyncAPI files | ||
|
||
publish-action-docker: | ||
name: Release github action for cli and update version in action.yml | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Get version without v character | ||
id: version | ||
run: | | ||
VERSION=${{github.event.release.tag_name}} | ||
VERSION_WITHOUT_V=${VERSION:1} | ||
echo "value=${VERSION_WITHOUT_V}" >> $GITHUB_OUTPUT | ||
- name: Release to Docker | ||
run: | | ||
echo ${{env.DOCKER_PASSWORD}} | docker login -u ${{env.DOCKER_USERNAME}} --password-stdin | ||
npm run action:docker:build | ||
docker tag asyncapi/github-action-for-cli:latest asyncapi/github-action-for-cli:${{ steps.version.outputs.value }} | ||
docker push asyncapi/github-action-for-cli:${{ steps.version.outputs.value }} | ||
docker push asyncapi/github-action-for-cli:latest | ||
- name: Change directory to github-action | ||
run: | | ||
cd github-action/ | ||
ls -la | ||
- uses: meeDamian/[email protected] | ||
with: | ||
user: ${{ env.DOCKER_USERNAME }} | ||
pass: ${{ env.DOCKER_PASSWORD }} | ||
slug: asyncapi/github-action-for-cli | ||
description: Github action for AsyncAPI CLI | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = async (pluginConfig, context) => { | ||
const { nextRelease } = context; | ||
const version = nextRelease.version; | ||
|
||
const templatePath = path.resolve(__dirname, '../../', 'action-template.yml'); | ||
const outputPath = path.resolve(__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; | ||
} | ||
}; |