Skip to content

Commit e719e13

Browse files
authored
Merge pull request #60 from gruntwork-io/caitlin/report-patcher-action-version
surface patcher-action version in env vars
2 parents 8bdde57 + dc19c9f commit e719e13

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Version Increment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- run: git config user.email "[email protected]"
14+
- run: git config user.name "$GITHUB_ACTOR"
15+
- run: npm version minor -m "v%s"
16+
- run: VERSION=$(node -p "require('./package.json').version")
17+
- run: git tag ${VERSION}
18+
- run: git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --follow-tags

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
categories:
6+
- title: Breaking Changes
7+
labels:
8+
- breaking-change
9+
- title: Bug Fixes
10+
labels:
11+
- bug
12+
- title: New Features
13+
labels:
14+
- enhancement
15+
- title: Other Changes
16+
labels:
17+
- "*"
18+

dist/index.js

Lines changed: 12 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "patcher-action",
3-
"version": "0.2.3",
3+
"version": "2.4.2",
44
"description": "Run Patcher by Gruntwork.io",
55
"main": "index.js",
66
"repository": "[email protected]:gruntwork-io/patcher-action.git",

src/action.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ function getPatcherEnvVars(
290290
updateToken: string
291291
): { [key: string]: string } {
292292
const telemetryId = `GHAction-${github.context.repo.owner}/${github.context.repo.repo}`;
293+
// this is a workaround to get the version from the package.json file, since rootDir doesn't contain the package.json file
294+
// eslint-disable-next-line @typescript-eslint/no-var-requires
295+
const packageJson = require("../package.json");
293296

294297
return {
295298
...process.env,
@@ -298,6 +301,7 @@ function getPatcherEnvVars(
298301
PATCHER_TELEMETRY_ID: telemetryId,
299302
GIT_AUTHOR_NAME: gitCommiter.name,
300303
GIT_AUTHOR_EMAIL: gitCommiter.email,
304+
PATCHER_ACTIONS_VERSION: `v${packageJson.version}`,
301305
};
302306
}
303307

0 commit comments

Comments
 (0)