set up crates.io deployment in github actions

This commit is contained in:
Clément DOUIN 2022-02-03 15:47:15 +01:00
parent 9e320135ec
commit 8f202b0f00
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72

View file

@ -2,6 +2,8 @@ name: deployment
on: on:
push: push:
branches:
- master
tags: tags:
- v* - v*
@ -9,21 +11,21 @@ jobs:
create_release: create_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
upload_url: ${{steps.create_release.outputs.upload_url}} upload_url: ${{ steps.create_release.outputs.upload_url }}
steps: steps:
- name: Create release - name: Create release
id: create_release id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{github.ref}} tag_name: ${{ github.ref }}
release_name: ${{github.ref}} release_name: ${{ github.ref }}
draft: false draft: false
prerelease: false prerelease: false
build: deploy_binaries:
needs: create_release needs: create_release
runs-on: ${{matrix.os}} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -59,9 +61,25 @@ jobs:
- name: Upload release asset - name: Upload release asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{needs.create_release.outputs.upload_url}} upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: himalaya.tar.gz asset_path: himalaya.tar.gz
asset_name: himalaya-${{matrix.os_name}}.tar.gz asset_name: himalaya-${{ matrix.os_name }}.tar.gz
asset_content_type: application/gzip asset_content_type: application/gzip
deploy_crate:
needs: create_release
runs-on: linux
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Check project
uses: actions-rs/cargo@v1
with:
command: check
- name: Publish package to crates.io
run: cargo publish