2021-05-28 04:56:27 +08:00
|
|
|
name: Manual Release
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2023-01-03 09:49:54 +08:00
|
|
|
version:
|
|
|
|
description: 'Version'
|
|
|
|
type: choice
|
2021-05-28 04:56:27 +08:00
|
|
|
required: true
|
2023-01-07 04:50:25 +08:00
|
|
|
default: fix
|
2023-01-03 09:49:54 +08:00
|
|
|
options:
|
2023-01-07 04:50:25 +08:00
|
|
|
- fix
|
|
|
|
- feat
|
2023-01-03 09:49:54 +08:00
|
|
|
dryRun:
|
|
|
|
description: 'DryRun'
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
# ENV and Config
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
GIT_AUTHOR_NAME: github-actions
|
|
|
|
GIT_AUTHOR_EMAIL: github-actions@github.com
|
|
|
|
GIT_COMMITTER_NAME: github-actions
|
|
|
|
GIT_COMMITTER_EMAIL: github-actions@github.com
|
|
|
|
CI: true
|
|
|
|
CONFIG_NODE_VERSION: '["lts/*"]'
|
|
|
|
CONFIG_OS: '["ubuntu-latest"]'
|
|
|
|
# Main Job
|
2021-05-28 04:56:27 +08:00
|
|
|
jobs:
|
2023-01-03 09:49:54 +08:00
|
|
|
config:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
NODE_VERSION: ${{ steps.set-config.outputs.CONFIG_NODE_VERSION }}
|
|
|
|
OS: ${{ steps.set-config.outputs.CONFIG_OS }}
|
|
|
|
steps:
|
|
|
|
- id: set-config
|
|
|
|
run: |
|
|
|
|
echo "CONFIG_NODE_VERSION=${{ toJSON(env.CONFIG_NODE_VERSION) }}" >> $GITHUB_OUTPUT
|
|
|
|
echo "CONFIG_OS=${{ toJSON(env.CONFIG_OS) }}" >> $GITHUB_OUTPUT
|
|
|
|
release-manual:
|
|
|
|
name: Test, Build and force Release
|
|
|
|
needs: config
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.OS }}
|
2021-05-28 04:56:27 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-01-03 09:49:54 +08:00
|
|
|
OS: ${{ fromJSON(needs.config.outputs.OS) }}
|
|
|
|
NODE_VERSION: ${{ fromJSON(needs.config.outputs.NODE_VERSION) }}
|
|
|
|
|
2021-05-28 04:56:27 +08:00
|
|
|
steps:
|
2023-01-03 09:49:54 +08:00
|
|
|
- name: Checkout repo
|
2024-02-16 07:53:05 +08:00
|
|
|
uses: actions/checkout@v4
|
2023-01-03 09:49:54 +08:00
|
|
|
- name: Setup Node.js ${{ matrix.NODE_VERSION }}
|
2024-02-16 07:53:05 +08:00
|
|
|
uses: actions/setup-node@v4
|
2021-05-28 04:56:27 +08:00
|
|
|
with:
|
2023-01-03 09:49:54 +08:00
|
|
|
node-version: ${{ matrix.NODE_VERSION }}
|
|
|
|
- name: Commit trigger
|
|
|
|
run: |
|
|
|
|
git commit --allow-empty -m "${{ github.event.inputs.version }}: Trigger Manual Release"
|
2021-05-28 04:56:27 +08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
- name: Build Library
|
|
|
|
run: npm run build --if-present
|
|
|
|
- name: Run Tests
|
|
|
|
run: npm test --if-present
|
2023-01-07 04:50:25 +08:00
|
|
|
- name: Create a release - ${{ github.event.inputs.version }}
|
2023-01-03 04:06:33 +08:00
|
|
|
uses: cycjimmy/semantic-release-action@v3
|
2021-05-28 04:56:27 +08:00
|
|
|
with:
|
2023-01-03 09:49:54 +08:00
|
|
|
dry_run: ${{ github.event.inputs.dryRun == 'true' }}
|
2021-05-28 04:56:27 +08:00
|
|
|
extra_plugins: |
|
2023-01-03 04:06:33 +08:00
|
|
|
@semantic-release/changelog
|
2021-05-28 04:56:27 +08:00
|
|
|
@semantic-release/git
|