Skip to content

Commit

Permalink
chore: make release flow (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
keiya01 and github-actions[bot] authored Jun 3, 2024
1 parent 562cdbf commit f95d453
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 2 deletions.
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

0 comments on commit f95d453

Please sign in to comment.