This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
generated from im-open/javascript-action-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a warning message about deprecation
- Loading branch information
1 parent
375b477
commit 02da049
Showing
3 changed files
with
14 additions
and
34 deletions.
There are no files selected for viewing
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,49 +1,26 @@ | ||
# Workflow Code: AngryGoose_v2 DO NOT REMOVE | ||
|
||
name: Increment Version on Merge | ||
on: | ||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
increment-version: | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | ||
runs-on: [ubuntu-20.04] | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# See https://github.com/im-open/git-version for more details around how to increment major/minor/patch through commit messages | ||
- name: Increment the version | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const util = require('util'); | ||
const exec = util.promisify(require('child_process').exec); | ||
let newTag; | ||
try { | ||
({ stdout: tag } = await exec(`git describe --tags --abbrev=0`)); | ||
tag = tag.replace('\n', '').trim(); | ||
core.info(`The latest tag is: ${tag}`); | ||
const majorMinorPatch = tag.split('.'); | ||
const patch = parseInt(majorMinorPatch[2]) + 1; | ||
newTag = `${majorMinorPatch[0]}.${majorMinorPatch[1]}.${patch}` | ||
core.info(`The new tag is: ${newTag}`); | ||
} | ||
catch (error) { | ||
newTag = 'v1.0.0'; | ||
core.info('An error occurred getting the tags for the repo. It most likely does not have any tags to use. Defaulting to v1.0.0.'); | ||
core.info(error); | ||
} | ||
core.info(`Pushing tag '${newTag}' to the repository...`) | ||
await github.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: `refs/tags/${newTag}`, | ||
sha: context.sha | ||
}); | ||
uses: im-open/[email protected] | ||
with: | ||
create-ref: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
default-release-type: major |
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