Skip to content

Commit 5fbe3d5

Browse files
committed
Tweaks to publish script using changesets
1 parent b3ae6a2 commit 5fbe3d5

File tree

6 files changed

+65
-28
lines changed

6 files changed

+65
-28
lines changed

.github/actions/push/action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Push'
2+
description: 'Push changes to the remote repository.'
3+
4+
branding:
5+
icon: git-branch
6+
color: blue
7+
8+
inputs:
9+
branch:
10+
description: 'Branch to push to'
11+
required: false
12+
default: 'main'
13+
tags:
14+
description: 'Push tags'
15+
required: false
16+
default: 'false'
17+
message:
18+
description: 'Commit message (empty means no commit)'
19+
required: false
20+
user:
21+
description: 'Git user name'
22+
required: false
23+
default: 'github-actions[bot]'
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Setup Git User
29+
run: |
30+
git config --global user.name "${{ inputs.user }}"
31+
git config --global user.email "${{ inputs.user }}@users.noreply.github.com"
32+
shell: bash
33+
- name: Git Commit
34+
if: ${{ inputs.message != '' }}
35+
run: |
36+
git add .
37+
git commit -m "${{ inputs.message }}"
38+
shell: bash
39+
- name: Push Changes
40+
run: |
41+
git push origin ${{ inputs.branch }}
42+
if [ ${{ inputs.tags }} = 'true' ]; then
43+
git push --tags
44+
fi
45+
shell: bash

.github/actions/sync/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,3 @@ runs:
2424
done
2525
' _ {} +
2626
shell: bash
27-
- name: Push Changes
28-
run: |
29-
if [[ $(git status --porcelain) ]]; then
30-
git add **/Cargo.toml
31-
git commit -m "Sync cargo versions"
32-
git push
33-
fi
34-
shell: bash

.github/workflows/automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
automerge:
1010
runs-on: ubuntu-latest
11-
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'github-actions[bot]' }}
11+
if: ${{ github.actor == 'dependabot[bot]' }}
1212
permissions:
1313
pull-requests: write
1414
contents: write

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
changeset:
5252
runs-on: ubuntu-latest
53-
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' }}
53+
if: ${{ github.actor != 'dependabot[bot]' }}
5454
steps:
5555
- name: Checkout repository
5656
uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Publish
22

33
on:
4-
push:
5-
branches: [main]
4+
workflow_dispatch:
65

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

@@ -11,26 +10,29 @@ jobs:
1110
runs-on: ubuntu-latest
1211
permissions:
1312
contents: write
14-
pull-requests: write
15-
outputs:
16-
published: ${{ steps.changesets.outputs.published }}
1713
steps:
1814
- name: Checkout repository
1915
uses: actions/checkout@v4
16+
with:
17+
ssh-key: ${{ secrets.GH_DEPLOY_KEY }}
2018
- name: Setup Anchor
2119
uses: ./.github/actions/anchor
2220
- name: Install dependencies
2321
run: yarn install
24-
- name: Create Release Pull Request or Publish
25-
id: changesets
26-
uses: changesets/action@v1
27-
with:
28-
commit: 'Publish packages'
29-
title: 'Publish packages'
30-
publish: 'yarn publish'
22+
- name: Determine New Versions
23+
run: yarn changeset version
24+
- name: Update Cargo Version Numbers
25+
uses: ./.github/actions/sync
26+
- name: Publish Packages
27+
run: yarn publish
3128
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3329
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3430
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
35-
- name: Update Cargo Version Numbers
36-
uses: ./.github/actions/sync
31+
- name: Tag Release
32+
run: yarn changeset tag
33+
- name: Push Changes
34+
uses: ./.github/actions/push
35+
with:
36+
branch: main
37+
message: Publish Packages
38+
user: changests[bot]

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@ If you want to stream the logs of a specific command you can add the `--output-s
9292

9393
When contributing to this repository, please include a changeset with your changes. You can create a changeset by running `yarn changeset`. If your changes are not related to any of the packages, you can create an empty changeset by running `yarn changeset --empty`. In your pull request, you do not have to manually update the version numbers.
9494

95-
When changes are detected in main, `changesets` will automatically create a pull request to update the version of the packages. Once that pull request is merged, the packages will be published to the npm and cargo automatically.
95+
To publish packages to npm and cargo, you can run run the `publish` gh action. This will update the versions of the packages and publish them to npm and cargo.
9696

9797
# Support
9898

99-
### Questions
100-
10199
Have problems integrating with the SDK? Pop by over to the Orca [Discord](https://discord.gg/nSwGWn5KSG) #dev-questions channel and chat with one of our engineers.
102100

103101
### Feedback

0 commit comments

Comments
 (0)