feat: add release workflow
This commit is contained in:
86
.github/workflows/release.yaml
vendored
Normal file
86
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
name: Build & Lint & Test & Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_VERSION: lts/*
|
||||
GPG_KEY_ID: ${{ vars.GPG_KEY_ID }}
|
||||
|
||||
jobs:
|
||||
main:
|
||||
name: Build & Lint & Test & Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: ⤵️ Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: 🙂↔️ Import GPG key
|
||||
run: |
|
||||
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
|
||||
echo -e "5\ny\n" | gpg --batch --yes --command-fd 0 --edit-key ${{ env.GPG_KEY_ID }} trust quit
|
||||
env:
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
|
||||
- name: 🫡 Setup Git
|
||||
run: |
|
||||
git config --global user.name "Nexim Bot"
|
||||
git config --global user.email "bot@thenexim.com"
|
||||
git config --global user.signingkey ${{ env.GPG_KEY_ID }}
|
||||
git config --global commit.gpgsign true
|
||||
|
||||
- name: 🔧 Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.NODE_VERSION }}
|
||||
|
||||
- name: 🛠️ Setup Node.js Corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: 📦 Get Yarn Config
|
||||
id: yarn_config
|
||||
run: echo "cache_folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 🗄️ Cache Layer
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.yarn_config.outputs.cache_folder }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: 📥 Install Dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: 🗃️ Cache Wireit
|
||||
uses: google/wireit@setup-github-actions-caching/v2
|
||||
|
||||
- name: 🏗️ Build TypeScript
|
||||
run: yarn build
|
||||
env:
|
||||
WIREIT_LOGGER: metrics
|
||||
|
||||
- name: 🧹 Run ESLint
|
||||
run: yarn lint
|
||||
env:
|
||||
WIREIT_LOGGER: metrics
|
||||
|
||||
- name: 🧪 Run Tests
|
||||
run: yarn test
|
||||
env:
|
||||
WIREIT_LOGGER: metrics
|
||||
|
||||
- name: 🤖 Get Release
|
||||
run: yarn lerna version --yes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||
WIREIT_LOGGER: metrics
|
||||
Reference in New Issue
Block a user