mirror of
https://github.com/SomboChea/ui
synced 2026-01-16 08:05:44 +07:00
GitHub actions (#32)
* chore: fixes snapshots test * chore: adds github actions, issue and feat templates * chore: fixes eslint * chore: remvoes circle ci and adds publish action * chore: adds github-release automation using actions
This commit is contained in:
committed by
Juan Picado @jotadeveloper
parent
96b65d969a
commit
4a459df463
8
scripts/github-release.sh
Normal file
8
scripts/github-release.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
# Get the last tag from GitHub
|
||||
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
|
||||
changelog=$(git show $GITHUB_SHA --unified=0 CHANGELOG.md | tail +12 | sed -e 's/^\+//')
|
||||
|
||||
echo "$changelog"
|
||||
|
||||
echo "$changelog" | node scripts/trigger-release.js $lastTag
|
||||
@@ -6,5 +6,8 @@ lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
# Print it to the console for verification
|
||||
echo "Bumping version to new tag: ${lastTag}"
|
||||
|
||||
# creating .npmrc
|
||||
echo "//$REGISTRY_URL/:_authToken=$REGISTRY_AUTH_TOKEN" > .npmrc
|
||||
|
||||
# Publish to NPM
|
||||
npm publish --registry https://registry.npmjs.org/
|
||||
npm publish --registry https://$REGISTRY_URL/
|
||||
|
||||
26
scripts/trigger-release.js
Normal file
26
scripts/trigger-release.js
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
const [ /* node */, /* file */, tag] = process.argv;
|
||||
|
||||
const getStdin = require("get-stdin");
|
||||
const Octokit = require('@octokit/rest');
|
||||
const octokit = new Octokit({
|
||||
auth: `token ${process.env.GITHUB_TOKEN}`,
|
||||
});
|
||||
|
||||
|
||||
const [repoOwner, repoName] = process.env.GITHUB_REPOSITORY.split("/");
|
||||
|
||||
getStdin()
|
||||
.then(changelog => octokit.repos.createRelease({
|
||||
owner: repoOwner,
|
||||
repo: repoName,
|
||||
tag_name: tag,
|
||||
body: changelog,
|
||||
draft: true,
|
||||
}))
|
||||
.catch(err => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user