Skip to content

Commit

Permalink
fix: version tags integration (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspnxdd authored Jul 26, 2022
1 parent 2450588 commit d7a5e1d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/deploy_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Extract version from tag
uses: damienaicheh/[email protected]

- name: Output the variables
run: |
echo The major was $MAJOR
echo The minor was $MINOR
echo The patch was $PATCH
echo The pre-release was $PRE_RELEASE
echo The number of commits was $NUMBER_OF_COMMITS
echo The number of commits since tag was $NUMBER_OF_COMMITS_SINCE_TAG
- name: save version file
uses: satackey/[email protected]
id: getdata
with:
# Edit the following line to install packages required to run your script.
required-packages: git-tags
script: |
var gittags = require("git-tags");
var fs = require("fs");
gittags.get(function (err, tags) {
if (err) throw err;
const obj = {
version: tags[0],
};
fs.writeFileSync("version.json", JSON.stringify(obj), "utf8");
console.log(tags);
});
- name: Deploy to Vercel Action
uses: BetaHuhn/deploy-to-vercel-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"tag": "node git-tags.js",
"tags": "node git-tags.js",
"start": "next start",
"lint": "next lint",
"format": "prettier --write \"./**/*.{tsx,ts,js}\""
Expand Down
1 change: 0 additions & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
{"version":"v0.0.1"}

0 comments on commit d7a5e1d

Please sign in to comment.