Skip to content

Starting release for mukulmishra18 PR merge #1

Starting release for mukulmishra18 PR merge

Starting release for mukulmishra18 PR merge #1

Workflow file for this run

name: Merge
run-name: Starting release for ${{ github.actor }} PR merge
on:
pull_request:
types:
- closed
branches:
# Test branch for testing the merge workflow, will be changed to develop
- feature/test-automated-release
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
package-json-version: ${{ steps.define-release-version.outputs.packageJsonVersion }}
full-release-version: ${{ fromJson(steps.define-release-version.outputs.result).full }}
steps:
- name: Read package.json version
uses: actions/github-script@v6
id: define-package-json-version
with:
script: |
const { version } = require('./package.json')
core.info(`performing a ${{ inputs.release-type }} release for existing version ${version}`)
core.setOutput('packageJsonVersion', version)
- name: Define release version
uses: actions/github-script@v6
id: define-release-version
with:
script: |

Check failure on line 31 in .github/workflows/merge.yml

View workflow run for this annotation

GitHub Actions / Merge

Invalid workflow file

The workflow is not valid. .github/workflows/merge.yml (Line: 31, Col: 19): Unrecognized named-value: 'package-json-version'. Located at position 1 within expression: package-json-version .github/workflows/merge.yml (Line: 40, Col: 14): Unrecognized named-value: 'full-release-version'. Located at position 1 within expression: full-release-version

Check failure on line 31 in .github/workflows/merge.yml

View workflow run for this annotation

GitHub Actions / Merge

Invalid workflow file

The workflow is not valid. .github/workflows/merge.yml (Line: 31, Col: 19): Unrecognized named-value: 'package-json-version'. Located at position 1 within expression: package-json-version .github/workflows/merge.yml (Line: 40, Col: 14): Unrecognized named-value: 'full-release-version'. Located at position 1 within expression: full-release-version
const { defineReleaseVersion } = require('./.github/scripts/defineVersion.js')
return defineReleaseVersion({core}, "${{ inputs.release-type || 'minor' }}", "${{ inputs.prerelease-label }}", "${{ package-json-version }}" )
- name: Checkout develop
uses: actions/checkout@v2
with:
ref: develop
token: ${{ secrets.GH_TOKEN }}
- name: Bump package.json version
run: |
git pull
RELEASE-VERSION=${{ full-release-version }}
npm version "${RELEASE-VERSION}"
- name: Update Changelog
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const { execSync } = require('child_process');
const { updateChangeLog } = require('./.github/scripts/updateChangelog.js')
const stableVersion = '${{ full-release-version }}'.split('-')[0]
const releaseDate = new Date().toISOString().split('T')[0]
const data = fs.readFileSync('./CHANGELOG.md',{encoding:'utf8', flag:'r'});
core.info(`Updating ${stableVersion} with date ${releaseDate} in Changelog`);
const changelogFileContents = updateChangeLog(data, stableVersion, releaseDate);
fs.writeFileSync('./CHANGELOG.md', changelogFileContents, 'utf-8');
- name: Push changes
with:
# Running a task with github token will not trigger a new workflow run
token: ${{ secrets.GH_TOKEN }}
run: |
git add .
git commit -m "Bump version ${{ full-release-version }} and update changelog"
git push --set-upstream origin develop
- name: Tag and push
uses: actions/github-script@v6
# Tag push should happen without a token, otherwise it will not trigger release workflow
with:
script: |
const { execSync } = require('child_process');
const { fullReleaseVersion } = ${{ full-release-version }}
const tag = `v${fullReleaseVersion}`;
const message = `Release ${fullReleaseVersion}`;
core.info(`Creating tag ${tag} with message ${message}`);
execSync(`git config --global user.name 'Automated Release'`);
execSync(`git config --global user.email '[email protected]'`);
execSync(`git tag -a ${tag} -m "${message}"`);
execSync(`git push --set-upstream origin develop ${tag}`);