davidliu

changeset ci fixes

@@ -10,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -10,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
10 10
11 permissions: 11 permissions:
12 contents: write 12 contents: write
  13 + pull-requests: write
13 14
14 jobs: 15 jobs:
15 release: 16 release:
@@ -33,17 +34,24 @@ jobs: @@ -33,17 +34,24 @@ jobs:
33 - name: Install dependencies 34 - name: Install dependencies
34 run: pnpm install 35 run: pnpm install
35 36
  37 + - name: Make PR title
  38 + id: getver
  39 + run: echo "TITLE=v$(./ci/get_version.sh)" >> "$GITHUB_OUTPUT"
  40 +
36 - name: Create Release Pull Request 41 - name: Create Release Pull Request
37 id: changesets 42 id: changesets
38 uses: changesets/action@v1 43 uses: changesets/action@v1
39 with: 44 with:
  45 + title: ${{ steps.getver.outputs.TITLE }}
  46 + commit: ${{ steps.getver.outputs.TITLE }}
40 version: pnpm ci:version 47 version: pnpm ci:version
41 publish: pnpm ci:publish 48 publish: pnpm ci:publish
42 env: 49 env:
43 # requires repo and read:user access 50 # requires repo and read:user access
44 GITHUB_TOKEN: ${{ secrets.CHANGESET_GH_TOKEN }} 51 GITHUB_TOKEN: ${{ secrets.CHANGESET_GH_TOKEN }}
45 outputs: 52 outputs:
46 - hasPublishedKotlin: ${{ steps.changesets.outputs.published == 'true' }} 53 + publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
  54 + hasPublished: ${{ steps.changesets.outputs.published == 'true' }}
47 55
48 debug-outputs: 56 debug-outputs:
49 needs: release 57 needs: release
@@ -52,4 +60,30 @@ jobs: @@ -52,4 +60,30 @@ jobs:
52 steps: 60 steps:
53 - name: "echo outputs" 61 - name: "echo outputs"
54 run: | 62 run: |
55 - echo ${{ steps.changesets.outputs.publishedPackages }}  
  63 + echo ${{ needs.release.outputs.publishedPackages }}
  64 + echo ${{ needs.release.outputs.hasPublished }}
  65 +
  66 + update-snapshot:
  67 + needs: release
  68 + name: Update SNAPSHOT
  69 + if: ${{ needs.release.outputs.hasPublished == 'true' }}
  70 + runs-on: ubuntu-latest
  71 +
  72 + steps:
  73 + - name: Checkout Repo
  74 + uses: actions/checkout@v4
  75 +
  76 + - name: Update snapshot
  77 + id: update
  78 + run: echo "SNAPSHOT_VERSION=$(./ci/update_snapshot_version.sh)" >> "$GITHUB_OUTPUT"
  79 +
  80 + - name: Log version
  81 + env:
  82 + SNAPSHOT_VERSION: ${{ steps.update.outputs.SNAPSHOT_VERSION }}
  83 + run: echo $SNAPSHOT_VERSION
  84 +
  85 + - name: Create Update SNAPSHOT Pull Request
  86 + uses: peter-evans/create-pull-request@v6
  87 + with:
  88 + branch: dl/update_snapshot_ver
  89 + title: Prepare snapshot version ${{ steps.update.outputs.SNAPSHOT_VERSION }}
1 -name: Update SNAPSHOT PR action 1 +name: Manually create SNAPSHOT update PR
2 2
3 on: 3 on:
4 workflow_dispatch: 4 workflow_dispatch:
5 - push:  
6 - # only need on new version tags  
7 - tags:  
8 - - v*  
9 5
10 concurrency: ${{ github.workflow }}-${{ github.ref }} 6 concurrency: ${{ github.workflow }}-${{ github.ref }}
11 7
12 permissions: 8 permissions:
13 contents: write 9 contents: write
  10 + pull-requests: write
14 11
15 jobs: 12 jobs:
16 - release: 13 + update-snapshot:
17 name: Update SNAPSHOT 14 name: Update SNAPSHOT
18 runs-on: ubuntu-latest 15 runs-on: ubuntu-latest
19 16
  1 +#!/bin/bash
  2 +set -e
  3 +set -x
  4 +
  5 +PACKAGE_VERSION=$(cat ./package.json | jq -r '.version')
  6 +echo "$PACKAGE_VERSION"