-
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.
chore(core): pre release events and actions
- Loading branch information
1 parent
1462944
commit b898ad4
Showing
11 changed files
with
282 additions
and
111 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Canary Release | ||
|
||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
|
||
permissions: | ||
contents: read | ||
pull-request: write | ||
package: write | ||
|
||
jobs: | ||
canary release: | ||
name: canary release | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'issue_comment' && | ||
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') && | ||
startsWith(github.event.comment.body, 'canary-release') | ||
steps: | ||
- name: get PR information | ||
uses: actions/github-script@v4 | ||
id: pr | ||
with: | ||
script: | | ||
const request = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
} | ||
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | ||
try { | ||
const result = await github.pulls.get(request); | ||
core.info(`Got PR: ${JSON.stringify(result.data)}`); | ||
return result.data; | ||
} catch (err) { | ||
core.setFailed(`Request failed with error: ${err}`) | ||
} | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ fromJSON(steps.pr.outputs.result).head.ref }} | ||
repository: ${{ fromJSON(steps.pr.output.result).head.repo.full_name }} | ||
fetch-depth: 0 | ||
- name: setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
registry-url: 'https://npm.pkg.github.com' | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.11 | ||
- name: Install | ||
run: pnpm install | ||
- name: Publish | ||
run: pnpm run release:canary | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '🎉 Canary Release. You can install canary version via `npm install [package]@next`' | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Create Pull Request | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
|
||
permissions: | ||
contents: true | ||
pull-request: write | ||
|
||
jobs: | ||
create pull request: | ||
if: | | ||
github.event_name == 'issue_comment' && | ||
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_assoiciation == 'OWNER') && | ||
startsWith(github.event.comment.body, '/create release') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.11 | ||
- name: Install | ||
run: pnpm run install | ||
- name: GIT Identity | ||
run: | | ||
git config --global user.name '${GITHUB_ACTOR}' | ||
git config --global user.email '${GITHUB_ACTOR}@uses.noreply.github.com' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_ACTOR: ${{ github.actor }} | ||
- name: VersionUP Commit | ||
run: | | ||
pnpm run versionup --yes | ||
- name: Set Current CHANGELOG to output | ||
id: changelog | ||
shell: bash -ex {0} | ||
run: | | ||
version=$(node -p 'require("./lerna.json").version') | ||
echo "::set-output name=version::$(version)" | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: 'Update v${{ steps.changelog.outputs.version }}' | ||
committer: Github <[email protected]> | ||
author: '${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>' | ||
title: 'v${{ steps.changelog.outputs.version }}' | ||
body: | | ||
## v${{ steps.changelog.outputs.version }} | ||
### Breaking Changes: | ||
- [ ] TODO | ||
### Features: | ||
- [ ] TODO | ||
### Bug Fixes | ||
- [ ] TODO | ||
labels: 'Type: Release' | ||
branch: release/next | ||
request-to-parent: false | ||
|
||
- name: Check Outputs | ||
run: | | ||
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}" |
Empty file.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Publish | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
|
||
permissions: | ||
contents: write | ||
pull-requerts: write | ||
packages: write | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: SetUp NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
registry-url: https//npm.pkg.github.com | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.11 | ||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install | ||
run: pnpm install | ||
- name: Set Current Version | ||
run: | | ||
CURRENT_VERSION=${node -p 'require("./lerna.json").version'} | ||
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV | ||
- name: Tag Check | ||
id: tag_check | ||
run: | | ||
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" | ||
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ | ||
-H "Authorization: token ${GITHUB_TOKEN}") | ||
if [ "$https_status_code" -ne "404" ]; then | ||
echo "::set-output name=exists_tag::true" | ||
else | ||
echo "::set-output name=exists_tag::false" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create GIT Tag | ||
if: steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ env.CURRENT_VERSION }} | ||
release_name: ${{ github.event.pull_request.title }} | ||
body: | | ||
${{ github.event.pull_request.body }} | ||
draft: false | ||
prerelease: false | ||
- name: Publish | ||
if: steps.tag_check.outputs.exists_tag == 'false' | ||
run: | | ||
pnpm lerna publish from-package --yes | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secret.GITHUB_TOKEN }} | ||
- uses: actions/github-scripts@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'https://github.com/${{ github.repository }}/release/tag/v${{ env.CURRENT_VERSION }} is released!!! ' | ||
}) |
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,5 +1,11 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "1.0.3", | ||
"npmClient": "pnpm" | ||
"npmClient": "pnpm", | ||
"includeMergedTags": true, | ||
"command": { | ||
"publish": { | ||
"registry": "https://npm.pkg.github.com" | ||
} | ||
} | ||
} |
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,16 +1,21 @@ | ||
{ | ||
"name": "root", | ||
"private": true, | ||
"version": "0.0.0-development", | ||
"version": "1.0.0", | ||
"author": { | ||
"name": "42devs", | ||
"email": "[email protected]", | ||
"url": "https://42devs.cl" | ||
}, | ||
"homepage": "https://github.com/42devs/packages_library", | ||
"bugs": { | ||
"url": "https://github.com/42devs/packages_library/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:42devs/packages_library.git" | ||
"url": "https://github.com/42devs/packages_library.git" | ||
}, | ||
"license": "MIT", | ||
"contributors": [ | ||
{ | ||
"name": "Nicolas Martinez V. @TheMakunga", | ||
|
@@ -34,14 +39,22 @@ | |
"clean:bundle": "npx lerna run clean:bundle --no-sort", | ||
"clean:dependencies": "npx lerna run clean:dependencies --no-sort", | ||
"commitMessage": "cz", | ||
"publish": "npx lerna run publish --no-sort", | ||
"prepare": "husky install", | ||
"lint": "npx lerna run lint --no-sort", | ||
"lint:fix": "npx lerna run lint:fix --no-sort", | ||
"test": "npx lerna run test --no-sort", | ||
"test:cov": "npx lerna run test:cov --no-sort", | ||
"release": "npx lerna run release --no-sort", | ||
"semantic-release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\${version}'" | ||
"versionup": "npx lerna version --conventional-commit --no-git-tag-version", | ||
"versionup:patch": "npx lerna version patch --conventional-commit --no-git-tag-version", | ||
"versionup:minor": "npx lerna version minor --conventional-commit --no-git-tag-version", | ||
"versionup:mayor": "npx lerna version mayor --conventional-commit --no-git-tag-version", | ||
"commit-version": "git add . && git commit -m \"chore(release): publish `node -p 'require('./lerna.json').version'`\"", | ||
"postversionup": "pnpm run commit-version", | ||
"postversionup:patch": "pnpm run commit-version", | ||
"postversionup:minor": "pnpm run commit-version", | ||
"postversionup:mayor": "pnpm run commit-version", | ||
"release": "npx lerna publish from-package", | ||
"release:canary": "npx lerna publish --canary --preid next --dist-tag next --force-publish='*' --no-push --no-git-tag-version --yes" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^18.4.3", | ||
|
Oops, something went wrong.