Skip to content

Commit

Permalink
Retrieve and add release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Miranlfk committed Jun 20, 2023
1 parent 88860b1 commit 4e22db5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 36 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,35 @@ jobs:
timeout: "10m0s"
- name: cosign-installer
uses: sigstore/cosign-installer@v3.0.3
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install GitHub CLI
run: |
npm install -g github-cli
gh --version
- name: Get Markdown file
id: file-url
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
gh repo view ballerina-platform/ballerina-dev-website --json url --jq '.clone_url'
gh api repos/ballerina-platform/ballerina-dev-website/contents/downloads/verification-notes/verification_notes_template.md -H 'Accept: application/vnd.github.v3.raw' > release_notes.md
- name: Update Markdown file
run: |
npm install
node docs/update-version-notes/update_version.js
env:
NEW_VERSION: ${{ steps.version-set.outputs.taggedVersion }}
- name: Read release notes from file
id: release_notes
uses: actions/github-script@v4
with:
github-token: ${{ secrets.BALLERINA_BOT_TOKEN }}
script: |
const fs = require('fs');
const releaseNotes = fs.readFileSync('docs/release_notes.md', 'utf8');
const releaseNotes = fs.readFileSync('release_notes.md', 'utf8');
core.setOutput('notes', releaseNotes);
- name: Create release
id: create_release
Expand Down
35 changes: 0 additions & 35 deletions docs/release_notes.md

This file was deleted.

23 changes: 23 additions & 0 deletions docs/update-version-notes/update_version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs = require('fs');

const markdownFile = 'release_notes.md';
const versionPlaceholder = '{{ version }}';
const newVersion = process.env.NEW_VERSION;

fs.readFile(markdownFile, 'utf8', (err, data) => {
if (err) {
console.error(err);
return;
}

const updatedContent = data.replace(new RegExp(versionPlaceholder, 'g'), newVersion);

fs.writeFile(markdownFile, updatedContent, 'utf8', (err) => {
if (err) {
console.error(err);
return;
}

console.log('Markdown file updated successfully!');
});
});

0 comments on commit 4e22db5

Please sign in to comment.