This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
generated from VitorLuizC/typescript-library-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from luongngocminh/dev
Chore: Added alpha release pipeline
- Loading branch information
Showing
7 changed files
with
149 additions
and
35 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,31 @@ | ||
name-template: 'v$RESOLVED_VERSION 🌈' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- title: '🧰 Maintenance' | ||
label: 'chore' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
template: | | ||
## What's Changed | ||
$CHANGES |
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,51 @@ | ||
name: Publish Alpha | ||
|
||
on: | ||
release: | ||
types: [prereleased] | ||
|
||
jobs: | ||
setup: | ||
permissions: | ||
contents: none | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.trim.outputs.version }} | ||
steps: | ||
- id: trim | ||
run: echo "version=${TAG:1}" >> $GITHUB_OUTPUT | ||
env: | ||
TAG: ${{ github.event.release.tag_name }} | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
|
||
steps: | ||
- name: 'Checkout the repository' | ||
uses: 'actions/checkout@v3' | ||
|
||
- name: 'Setup Node.js and npm' | ||
uses: './.github/actions/setup' | ||
|
||
- name: 'Generate package.json' | ||
run: npm run config:prerelease -- ${{ needs.setup.outputs.version }} | ||
|
||
- name: 'Pack npm package' | ||
run: npm pack | ||
|
||
- name: 'Publish to npm' | ||
run: npm publish --tag alpha --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Upload NPM package file | ||
id: upload-npm-package-file | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ needs.setup.outputs.version }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ${{ format('8xff-atm0s-media-js-{0}.tgz', needs.setup.outputs.version) }} | ||
asset_name: ${{ format('8xff-atm0s-media-js-{0}.tgz', needs.setup.outputs.version) }} | ||
asset_content_type: application/gzip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write # for release-drafter/release-drafter to create a github release | ||
pull-requests: write # for release-drafter/release-drafter to add label to PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 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,42 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
/** | ||
* A minimal description for a parsed package.json object. | ||
* @typedef {{ | ||
name: string; | ||
version: string; | ||
}} PackageJson | ||
*/ | ||
|
||
function main() { | ||
// eslint-disable-next-line no-undef | ||
const args = process.argv.slice(2); | ||
if (args.length !== 1) { | ||
throw new Error('Usage: node configurePrerelease.mjs <version>'); | ||
} | ||
|
||
const inputVersion = args[0]; | ||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); | ||
const packageJson = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8')); | ||
|
||
let version = inputVersion; | ||
|
||
if (inputVersion.includes('nightly')) { | ||
/** @type {PackageJson} */ | ||
const oldVersion = packageJson.version; | ||
version = `${oldVersion}-nightly.${new Date().toISOString().slice(0, 10).replace(/-/g, '')}`; | ||
} | ||
|
||
const packageJsonNew = { | ||
...packageJson, | ||
version, | ||
}; | ||
|
||
fs.writeFileSync(path.join(rootDir, 'package.json'), JSON.stringify(packageJsonNew, null, 2), 'utf-8'); | ||
|
||
// eslint-disable-next-line no-undef | ||
console.log(`Created package.nightly.json with version ${version}`); | ||
} | ||
|
||
main(); |