Skip to content

@stalniy fix: pre-builds everything to prevent types issues in co-dependent packages #69

@stalniy fix: pre-builds everything to prevent types issues in co-dependent packages

@stalniy fix: pre-builds everything to prevent types issues in co-dependent packages #69

Workflow file for this run

name: Release packages
on:
pull_request:
types: [closed, labeled]
# workflow_dispatch:
# inputs:
# packagePath:
# description: 'Package path'
# required: true
jobs:
release:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request || github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'released') }}
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.4.0
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
env:
cache-name: casl-deps
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run -r build
- name: Release
env:
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.RELEASE_NPM_TOKEN }}
ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }}
run: |
if [[ "${TRACE:-false}" == true || "${ACTIONS_STEP_DEBUG:-false}" == true ]]; then
set -o xtrace # Trace the execution of the script (debug)
fi
changed_paths="$(gh pr view --json files --jq '.files.[].path' "${{ github.event.pull_request.number }}" | cut -d / -f 1,2 | uniq)";
released_packages=$(./packages/dx/bin/release-packages.sh "$changed_paths");
if [[ "${{github.event.pull_request.number}}" != "" && "$released_packages" != "" ]]; then
gh pr comment "${{ github.event.pull_request.number }}" --body "🚀 Released in ${released_packages}"
fi