Skip to content

Commit

Permalink
changeset ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed Aug 21, 2024
1 parent 3663152 commit 00800b9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
release:
Expand All @@ -33,17 +34,24 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Make PR title
id: getver
run: echo "TITLE=v$(./ci/get_version.sh)" >> "$GITHUB_OUTPUT"

- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
title: ${{ steps.getver.outputs.TITLE }}
commit: ${{ steps.getver.outputs.TITLE }}
version: pnpm ci:version
publish: pnpm ci:publish
env:
# requires repo and read:user access
GITHUB_TOKEN: ${{ secrets.CHANGESET_GH_TOKEN }}
outputs:
hasPublishedKotlin: ${{ steps.changesets.outputs.published == 'true' }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
hasPublished: ${{ steps.changesets.outputs.published == 'true' }}

debug-outputs:
needs: release
Expand All @@ -52,4 +60,30 @@ jobs:
steps:
- name: "echo outputs"
run: |
echo ${{ steps.changesets.outputs.publishedPackages }}
echo ${{ needs.release.outputs.publishedPackages }}
echo ${{ needs.release.outputs.hasPublished }}
update-snapshot:
needs: release
name: Update SNAPSHOT
if: ${{ needs.release.outputs.hasPublished == 'true' }}
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Update snapshot
id: update
run: echo "SNAPSHOT_VERSION=$(./ci/update_snapshot_version.sh)" >> "$GITHUB_OUTPUT"

- name: Log version
env:
SNAPSHOT_VERSION: ${{ steps.update.outputs.SNAPSHOT_VERSION }}
run: echo $SNAPSHOT_VERSION

- name: Create Update SNAPSHOT Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: dl/update_snapshot_ver
title: Prepare snapshot version ${{ steps.update.outputs.SNAPSHOT_VERSION }}
11 changes: 4 additions & 7 deletions .github/workflows/update_snapshot_pr.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
name: Update SNAPSHOT PR action
name: Manually create SNAPSHOT update PR

on:
workflow_dispatch:
push:
# only need on new version tags
tags:
- v*

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
release:
update-snapshot:
name: Update SNAPSHOT
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Update snapshot
- name: Update snapshot
id: update
run: echo "SNAPSHOT_VERSION=$(./ci/update_snapshot_version.sh)" >> "$GITHUB_OUTPUT"

Expand Down
6 changes: 6 additions & 0 deletions ci/get_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
set -x

PACKAGE_VERSION=$(cat ./package.json | jq -r '.version')
echo "$PACKAGE_VERSION"

0 comments on commit 00800b9

Please sign in to comment.