mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
chore(cd): add continuous deployment workflow
This commit is contained in:
parent
e178475971
commit
cb95016d5e
1 changed files with 60 additions and 0 deletions
60
.github/workflows/cd.yml
vendored
Normal file
60
.github/workflows/cd.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
name: Continuous Deployment
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-github:
|
||||||
|
name: Publish on GitHub
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl]
|
||||||
|
steps:
|
||||||
|
- name: Checkout the repository
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Set the release version
|
||||||
|
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
target: ${{ matrix.TARGET }}
|
||||||
|
override: true
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --release --locked --target ${{ matrix.TARGET }}
|
||||||
|
- name: Prepare release assets
|
||||||
|
run: |
|
||||||
|
mkdir release/
|
||||||
|
cp {LICENSE,README.md,CHANGELOG.md,config.toml} release/
|
||||||
|
cp target/${{ matrix.TARGET }}/release/rustypaste release/
|
||||||
|
mv release/ rustypaste-${{ env.RELEASE_VERSION }}/
|
||||||
|
- name: Create release artifacts
|
||||||
|
run: |
|
||||||
|
tar -czvf rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \
|
||||||
|
rustypaste-${{ env.RELEASE_VERSION }}/
|
||||||
|
sha512sum rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz \
|
||||||
|
> rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sha512
|
||||||
|
- name: Upload the release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz
|
||||||
|
rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz.sha512
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
publish-crates-io:
|
||||||
|
name: Publish on crates.io
|
||||||
|
needs: publish-github
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout the repository
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Publish
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: publish
|
||||||
|
args: --locked --token ${{ secrets.CARGO_TOKEN }}
|
Loading…
Reference in a new issue