Skip to content

Commit

Permalink
chore: github action
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Oct 14, 2024
1 parent c415753 commit 2beae01
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'release'

on:
workflow_dispatch:
inputs:
release_type:
type: choice
default: auto
description: What kind of version upgrade
options:
- auto
- patch
- minor
- major

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*


- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}

- name: install jq
run: apt install jq

- name: Enable CorePack
run: |
corepack enable
yarn config get globalFolder # the yarn command will ensure the correct yarn version is downloaded and installed
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get globalFolder)"

- name: Remove package.json resolutions
run: echo "`jq 'delpaths([["resolutions"]])' package.json`" > package.json

- uses: actions/cache@v4
name: Handle node_modules Cache
id: yarn-node_modules # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-yarn-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- uses: actions/cache@v4
if: steps.yarn-node_modules.outputs.cache-hit != 'true'
name: Handle Yarn cache
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install deps
if: steps.yarn-node_modules.outputs.cache-hit != 'true'
uses: bahmutov/npm-install@v1
with:
install-command: yarn install --silent
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: run setup
run: |
npm run setup
- name: publish auto
if: github.event.inputs.release_type == 'auto'
run: |
npm run publish -- --force-publish
- name: publish
if: github.event.inputs.release_type != 'auto'
run: |
npm run publish -- --force-publish --bump ${{ github.event.inputs.release_type }}

0 comments on commit 2beae01

Please sign in to comment.