Skip to content

Commit

Permalink
build: enabled automated releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Oct 7, 2023
1 parent 3fc8205 commit 0bd38ea
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
node-version:
description: 'The node version to setup'
required: true
registry-url:
node-registry:
description: 'Define registry-url'
required: false

Expand All @@ -19,7 +19,7 @@ runs:
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
registry-url: ${{ inputs.node-registry }}

- name: Use cache
uses: actions/cache@v3
Expand All @@ -31,7 +31,7 @@ runs:
restore-keys: |
${{ runner.os }}-install-
- name: Install
shell: bash
run: |
npm install
- name: Install
shell: bash
run: |
npm ci
65 changes: 55 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ name: CI

on:
push:
branches:
- '**'
branches: [develop, master, next, beta, alpha]
pull_request:
branches:
- '**'
types: [ opened, synchronize ]

env:
PRIMARY_NODE_VERSION: 18
NODE_VERSION: 18
NODE_REGISTRY: 'https://registry.npmjs.org'

jobs:
install:
Expand All @@ -25,7 +24,8 @@ jobs:
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

build:
name: Build Packages
Expand All @@ -37,7 +37,9 @@ jobs:
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

- name: Build
uses: ./.github/actions/build

Expand All @@ -52,7 +54,8 @@ jobs:
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

- name: Build
uses: ./.github/actions/build
Expand All @@ -72,7 +75,8 @@ jobs:
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

- name: Build
uses: ./.github/actions/build
Expand All @@ -93,7 +97,8 @@ jobs:
- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

- name: Build
uses: ./.github/actions/build
Expand All @@ -107,3 +112,43 @@ jobs:
with:
token: ${{ secrets.codecov }}
directory: ./packages/ebec/coverage/

release:
name: Release
if: |
!startsWith(github.event.head_commit.message , 'chore(release):') &&
github.event_name == 'push' &&
github.ref_name != 'develop'
needs: [build, tests]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install
uses: ./.github/actions/install
with:
node-version: ${{ env.NODE_VERSION }}
node-registry: ${{ env.NODE_REGISTRY }}

- name: Build
uses: ./.github/actions/build

- name: Publish
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
if [ ${{ github.ref_name }} = master ]; then
npx lerna version --conventional-commits --conventional-graduate --yes
else
npx lerna version --conventional-commits --conventional-prerelease --preid ${{ github.ref_name }} --yes
fi
npx lerna publish from-git --yes
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
]
},
"version": {
"message": "build(release): publish",
"message": "chore(release): %s",
"createRelease": "github"
}
},
Expand Down

0 comments on commit 0bd38ea

Please sign in to comment.