Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add github action for publishing crates #1012

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/crates_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: crates_upload

on:
release:
types: [published]
push:
branches: [main]

permissions:
contents: read

jobs:
upload_release:
name: Upload release to crates.io
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Publish libcst_derive to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: >
--manifest-path ./native/libcst_derive/Cargo.toml
--allow-dirty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why --allow-dirty?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing locally with nektos/act and was getting an issue where cargo publish wouldn't allow files that weren't committed, even though the files were actually committed. Not sure if this would be the case on GitHub

--locked
--token ${{ secrets.CRATES_IO_TOKEN }}

- name: Publish libsct to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: >
--manifest-path ./native/libcst/Cargo.toml
--allow-dirty
--locked
--token ${{ secrets.CRATES_IO_TOKEN }}