more #1897
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
check_for_relevant_changes: | |
runs-on: ubuntu-latest | |
outputs: | |
shouldRun: ${{ steps.check_changes.outputs.shouldRun }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get changed files | |
id: get_changed_files | |
uses: Ana06/get-changed-files@v2.2.0 | |
- name: Check for changes in specific paths | |
id: check_changes | |
run: | | |
for file in ${{ steps.get_changed_files.outputs.all }}; do | |
if [[ $file =~ ^generator/konfig-dash/ && ! $file =~ \.md$ ]]; then | |
echo "shouldRun=true" >> "$GITHUB_OUTPUT" | |
exit 0 | |
fi | |
done | |
release: | |
needs: check_for_relevant_changes | |
if: needs.check_for_relevant_changes.outputs.shouldRun == 'true' | |
name: Release | |
runs-on: ubuntu-latest | |
env: | |
DIRECTORY: ./generator/konfig-dash | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
defaults: | |
run: | |
working-directory: ${{ env.DIRECTORY }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install Dependencies | |
run: yarn | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: yarn changeset:version | |
cwd: ${{ env.DIRECTORY }} | |
title: Version Packages & Generate Artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish if changesets do not exist | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: yarn changeset:publish |