Skip to content

Commit 09ddde9

Browse files
authored
Add publish github action (#59)
* Add publish action * Use package:vx.y.z instead of package@x.y.z * Update README * Fix github ref checks
1 parent 57424bd commit 09ddde9

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

.github/workflows/publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish Pyth SDK to crates.io
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
jobs:
8+
publish-pyth-sdk:
9+
name: Publish Pyth SDK
10+
if: ${{ startsWith(github.ref, "refs/tags/pyth-sdk:v") }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout sources
14+
uses: actions/checkout@v2
15+
16+
- name: Install stable toolchain
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
profile: minimal
20+
toolchain: stable
21+
override: true
22+
23+
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
24+
env:
25+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
26+
working-directory: "pyth-sdk"
27+
publish-pyth-sdk-solana:
28+
name: Publish Pyth SDK Solana
29+
if: ${{ startsWith(github.ref, "refs/tags/pyth-sdk-solana:v") }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout sources
33+
uses: actions/checkout@v2
34+
35+
- name: Install stable toolchain
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
profile: minimal
39+
toolchain: stable
40+
override: true
41+
42+
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
43+
env:
44+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
45+
working-directory: "pyth-sdk-solana"
46+
publish-pyth-sdk-terra:
47+
name: Publish Pyth SDK CW
48+
if: ${{ startsWith(github.ref, "refs/tags/pyth-sdk-cw:v") }}
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout sources
52+
uses: actions/checkout@v2
53+
54+
- name: Install stable toolchain
55+
uses: actions-rs/toolchain@v1
56+
with:
57+
profile: minimal
58+
toolchain: stable
59+
override: true
60+
61+
- run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
62+
env:
63+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
64+
working-directory: "pyth-sdk-cw"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ To release a new version of any of these crates, perform the following steps wit
4040
1. Increment the version number in `Cargo.toml`.
4141
You may use a version number with a `-beta.x` suffix such as `0.0.1-beta.0` to create opt-in test versions.
4242
2. Merge your change into `main` on github.
43-
3. Create and publish a new github release.
44-
We currently don't have a Github Action to automatically push releases to [crates.io](https://crates.io), but should set one up.
43+
3. Create and publish a new github release with the structure of `package:vx.y.z` such as `pyth-sdk-solana:v1.3.2`. It will trigger a github action
44+
and publishes the released package in [crates.io](https://crates.io)
4545

4646
### pre-commit hooks
4747
pre-commit is a tool that checks and fixes simple issues (formatting, ...) before each commit. You can install it by following [their website](https://pre-commit.com/). In order to enable checks for this repo run `pre-commit install` from command-line in the root of this repo.

0 commit comments

Comments
 (0)