|
| 1 | +name: Release Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**/*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + publish: |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - NodeVersion: 20.14.x |
| 14 | + NodeVersionDisplayName: 20 |
| 15 | + OS: ubuntu-latest |
| 16 | + name: Node.js v${{ matrix.NodeVersionDisplayName }} (${{ matrix.OS }}) |
| 17 | + runs-on: ${{ matrix.OS }} |
| 18 | + if: github.repository == 'coze-dev/rush-arch' |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Check Release Tag |
| 25 | + id: check_tag |
| 26 | + run: | |
| 27 | + HAS_VALID_TAG=$(git tag --points-at HEAD | grep -E "^v/.+/.+$" || true) |
| 28 | + if [ ! -z "$HAS_VALID_TAG" ]; then |
| 29 | + echo "has_valid_tag=true" >> $GITHUB_OUTPUT |
| 30 | + echo "Found valid tag: $HAS_VALID_TAG" |
| 31 | + else |
| 32 | + echo "has_valid_tag=false" >> $GITHUB_OUTPUT |
| 33 | + echo "No valid tag found" |
| 34 | + fi |
| 35 | +
|
| 36 | + - name: Config Git User |
| 37 | + if: steps.check_tag.outputs.has_valid_tag == 'true' |
| 38 | + run: | |
| 39 | + git config --local user.name "tecvan" |
| 40 | + git config --local user.email "[email protected]" |
| 41 | +
|
| 42 | + - uses: actions/setup-node@v3 |
| 43 | + if: steps.check_tag.outputs.has_valid_tag == 'true' |
| 44 | + with: |
| 45 | + node-version: ${{ matrix.NodeVersion }} |
| 46 | + registry-url: 'https://registry.npmjs.org' |
| 47 | + node-version-file: '.nvmrc' |
| 48 | + |
| 49 | + - name: Cache |
| 50 | + if: steps.check_tag.outputs.has_valid_tag == 'true' |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: | |
| 54 | + common/temp/pnpm-local |
| 55 | + common/temp/pnpm-store |
| 56 | + common/temp/install-run |
| 57 | + key: ${{ runner.os }}-rush-store-${{ hashFiles('common/config/subspaces/**/pnpm-lock.yaml') }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-rush-store-main |
| 60 | + ${{ runner.os }}-rush-store |
| 61 | +
|
| 62 | + - name: Install Dependencies |
| 63 | + if: steps.check_tag.outputs.has_valid_tag == 'true' |
| 64 | + run: | |
| 65 | + npm i -g @microsoft/[email protected] |
| 66 | + sudo apt-get update |
| 67 | + sudo apt-get install -y libasound2-dev |
| 68 | + node common/scripts/install-run-rush.js install |
| 69 | +
|
| 70 | + - name: Run Release |
| 71 | + if: steps.check_tag.outputs.has_valid_tag == 'true' |
| 72 | + run: node infra/rush-x/bin/run release --commit ${{ github.event.head_commit.id }} |
| 73 | + env: |
| 74 | + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} |
0 commit comments