chore: 🤖add git action install #2
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: | |
# 안정화되면 추가 | |
# paths: | |
# - '.changeset/**' | |
# - 'packages/**' | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache turbo build setup | |
uses: actions/cache@v4 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-turbo-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo- | |
- name: Basic install | |
uses: ./.github/composite-actions/install | |
- name: Build packages | |
run: pnpm build:packages | |
- name: Fetch latest from origin | |
run: git fetch origin | |
- name: Check for changes in packages and config directories | |
id: check_changes | |
run: | | |
previous_commit=${{ github.event.before }} | |
latest_commit=${{ github.sha }} | |
echo "Checking for changes between $previous_commit and $latest_commit..." | |
if git diff --quiet $previous_commit $latest_commit -- ./packages ./configs; then | |
echo "No changes detected in ./packages or ./configs." | |
exit 1 | |
else | |
echo "Changes detected in ./packages or ./configs." | |
fi | |
- name: Setup npmrc | |
if: success() | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: Create PR and publish versions | |
id: changesets | |
if: success() | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Get PR number from comment | |
id: pr | |
run: echo "::set-output name=pull_request_number::$(echo '${{ github.event.head_commit.message }}' | awk -F"[\#)]" '{print $2}' | awk 'match($0, /[0-9]+/) {print substr($0, RSTART, RLENGTH)}')" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Slack notification | |
if: steps.changesets.outputs.published == 'true' | |
run: pnpm slack ${{ steps.pr.outputs.pull_request_number }} '${{steps.changesets.outputs.publishedPackages}}' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
continue-on-error: true | |
- name: Generate documentation | |
if: steps.changesets.outputs.published == 'true' | |
uses: ./.github/composite-actions/gen-docs |