Initial commit #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish pre-release | |
on: | |
push: | |
branches: [main] | |
jobs: | |
github: | |
name: Publish GitHub | |
permissions: | |
contents: write | |
environment: GITHUB_PRE_RELEASE | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable-x86_64-unknown-linux-gnu | |
override: true | |
- name: Setup Cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Package | |
uses: actions-rs/cargo@v1 | |
with: | |
command: package | |
args: --all-features | |
- name: Read crate name | |
id: crate_name | |
run: echo "crate_name=$(cargo read-manifest | jq -r .name)" >> $GITHUB_OUTPUT | |
- name: Read version | |
id: version | |
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT | |
- name: Read git commit hash | |
id: commit_hash | |
run: echo "commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions | |
run: gh release create "${{ steps.commit_hash.outputs.commit_hash }}" --repo="$GITHUB_REPOSITORY" --target main --title="Pre-Release ${{ steps.commit_hash.outputs.commit_hash }} (${{ steps.version.outputs.version }})" --generate-notes --prerelease "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate" |