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 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74bc4bd
commit dd02e0b
Showing
37 changed files
with
3,939 additions
and
5,744 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,23 +1,32 @@ | ||
name: 'Setup' | ||
description: "Setups Node.js and npm to run GitHub Actions' jobs." | ||
description: "Setups Node.js and pnpm to run GitHub Actions' jobs." | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: 'Setup Node.js' | ||
uses: 'actions/setup-node@v3' | ||
uses: 'actions/setup-node@v4' | ||
with: | ||
node-version: '16.x' | ||
cache: 'npm' | ||
cache-dependency-path: '**/package-lock.json' | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: 'Setup pnpm' | ||
uses: 'pnpm/action-setup@v2' | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: 'Keep npm cache for future workflows' | ||
uses: 'actions/cache@v3' | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}" | ||
path: '~/.npm' | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
${{ runner.os }}-pnpm-store- | ||
- name: 'Install dependencies' | ||
run: 'npm ci' | ||
run: 'pnpm i' | ||
shell: 'bash' |
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,52 @@ | ||
name: Publish Alpha | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
setup: | ||
if: 'github.event.release.prerelease' | ||
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@v4' | ||
|
||
- name: 'Setup Node.js and pnpm' | ||
uses: './.github/actions/setup' | ||
|
||
- name: 'Generate package.json' | ||
run: npm run config:prerelease -- ${{ needs.setup.outputs.version }} | ||
|
||
- name: 'Pack npm package' | ||
run: pnpm pack | ||
|
||
- name: 'Publish to npm' | ||
run: pnpm publish --tag alpha --access public --no-git-checks | ||
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-react-{0}.tgz', needs.setup.outputs.version) }} | ||
asset_name: ${{ format('8xff-atm0s-media-react-{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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Publish nightly | ||
|
||
on: | ||
workflow_dispatch: {} | ||
repository_dispatch: | ||
types: [publish-nightly] | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
check_date: | ||
runs-on: ubuntu-latest | ||
name: Check latest commit | ||
outputs: | ||
should_run: ${{ steps.should_run.outputs.should_run }} | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Print Latest Commit | ||
run: echo ${{ github.sha }} | ||
|
||
- id: should_run | ||
continue-on-error: true | ||
name: Check if latest commit is less than a day | ||
# if: ${{ github.event_name == 'schedule' }} | ||
run: | | ||
COMMIT_DATE=$(git show -s --format=%ci ${{ github.sha }}) | ||
COMMIT_DATE=$(date -d "$COMMIT_DATE" +%s) | ||
NOW=$(date +%s) | ||
DIFF=$(($NOW - $COMMIT_DATE)) | ||
echo "Commit date: $COMMIT_DATE" | ||
echo "Now: $NOW" | ||
echo "Diff: $DIFF" | ||
if [ $DIFF -lt 86400 ]; then | ||
echo "should_run=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "should_run=false" >> $GITHUB_OUTPUT | ||
fi | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: check_date | ||
if: ${{ needs.check_date.outputs.should_run == 'true' }} | ||
steps: | ||
- name: 'Checkout the repository' | ||
uses: 'actions/checkout@v4' | ||
|
||
- name: 'Setup Node.js and pnpm' | ||
uses: './.github/actions/setup' | ||
|
||
- name: 'Generate nightly package.json' | ||
run: pnpm config:prerelease -- nightly | ||
|
||
- run: pnpm publish --tag nightly --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_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
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
Oops, something went wrong.