Skip to content

Release

Release #45

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
package:
type: choice
description: Select package to publish
options:
- nestjs-auth
- nestjs-logger
- nestjs-storage
- "SHIP EVERYTHING!!"
concurrency: release
jobs:
dev_to_master:
name: merge dev into master
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Merge branch
uses: emiliopedrollo/[email protected]
if: github.ref_name == 'develop'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_ref: develop
target_branch: master
allow_fast_forward: false
build_package:
name: build package
needs:
- dev_to_master
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Set NX sha
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: master
- name: NPM clean install
run: npm ci
- name: Lint Package
if: inputs.package != 'SHIP EVERYTHING!!'
run: npx nx run ${{ inputs.package }}:lint
- name: Test Package
if: inputs.package != 'SHIP EVERYTHING!!'
run: npx nx run ${{ inputs.package }}:test:ci
- name: Build Package
if: inputs.package != 'SHIP EVERYTHING!!'
run: npx nx run ${{ inputs.package }}:build
- name: Lint All
if: inputs.package == 'SHIP EVERYTHING!!'
run: npx nx affected --target=lint --parallel=3
- name: Test All
if: inputs.package == 'SHIP EVERYTHING!!'
run: npx nx affected --target=test --parallel=3 --ci --code-coverage
- name: Build All
if: inputs.package == 'SHIP EVERYTHING!!'
run: npx nx run-many --target=build --parallel=3 --exclude=api --exclude=workspace-plugin
- name: Release
if: success()
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ inputs.package }}" = "SHIP EVERYTHING!!" ]; then
GITHUB_REF=master npx multi-semantic-release
else
DIRS=$(find ./libs -maxdepth 1 -type d | grep -v "^./libs$" | grep -v "${{ inputs.package }}")
EXCLUDE_PATTERNS=$(echo "$DIRS" | sed 's|^./||; s|$|/**|' | tr '\n' ',' | sed 's/,$//')
GITHUB_REF=master npx multi-semantic-release --ignore-packages=$EXCLUDE_PATTERNS
fi
master_to_dev:
name: merge master into dev
needs:
- dev_to_master
- build_package
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Merge branch
uses: emiliopedrollo/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_ref: master
target_branch: develop
allow_fast_forward: false