Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make release flow #16

Merged
merged 10 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/npm_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
workflow_call:
inputs:
branch:
required: true
type: string
tag:
required: true
type: string
version-args:
required: true
type: string
secrets:
NPM_TOKEN:
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "path=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.path }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run install
run: yarn install --frozen-lockfile

# Ref: https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
- name: Set up github actions user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Run npm version
run: npm version ${{ inputs.version-args }}

- name: Git push
run: |
git push origin ${{ inputs.branch }}
git push --tags

- name: Release to NPM
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ inputs.tag }}
13 changes: 13 additions & 0 deletions .github/workflows/release_alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
push:
branches: alpha

jobs:
release:
uses: reearth/core/.github/workflows/npm_release.yml@main
with:
branch: alpha
tag: alpha
version-args: --preid alpha prerelease
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/release_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
push:
branches: beta

jobs:
release:
uses: reearth/core/.github/workflows/npm_release.yml@main
with:
branch: beta
tag: beta
version-args: --preid beta prerelease
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
workflow_dispatch:
inputs:
version-type:
required: true
type: choice
options:
- major
- minor
- patch

jobs:
release:
uses: reearth/core/.github/workflows/npm_release.yml@main
with:
branch: main
tag: latest
version-args: ${{ inputs.version-type }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reearth/core",
"version": "0.0.4",
"version": "0.0.5-beta.0",
"author": "Re:Earth contributors <[email protected]>",
"license": "Apache-2.0",
"description": "A library that abstracts a map engine as one common API.",
Expand All @@ -19,7 +19,9 @@
"preview": "vite preview",
"test": "vitest",
"storybook": "storybook dev -p 6007",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"preversion": "yarn test run",
"version": "yarn build"
},
"engines": {
"node": ">=20"
Expand Down
Loading