2021-07-27 08:56:34 -04:00
|
|
|
name: Continuous Deployment
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "v*.*.*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-github:
|
|
|
|
name: Publish on GitHub
|
2023-05-10 17:40:08 -04:00
|
|
|
runs-on: ubuntu-22.04
|
2021-07-27 08:56:34 -04:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
TARGET: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl]
|
|
|
|
steps:
|
|
|
|
- name: Checkout the repository
|
2023-05-14 06:48:39 -04:00
|
|
|
uses: actions/checkout@v3
|
2021-07-27 08:56:34 -04:00
|
|
|
- name: Set the release version
|
|
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
2021-07-27 09:57:56 -04:00
|
|
|
- name: Install musl-tools
|
|
|
|
if: matrix.TARGET == 'x86_64-unknown-linux-musl'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y --no-install-recommends \
|
|
|
|
--allow-unauthenticated musl-tools
|
2021-07-27 08:56:34 -04:00
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.TARGET }}
|
|
|
|
override: true
|
|
|
|
- name: Build
|
2022-03-23 09:48:31 -04:00
|
|
|
run: |
|
|
|
|
cargo build --release --locked --target ${{ matrix.TARGET }}
|
|
|
|
strip target/${{ matrix.TARGET }}/release/rustypaste
|
2021-07-27 08:56:34 -04:00
|
|
|
- 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
|
2021-08-09 17:00:14 -04:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
2021-07-27 08:56:34 -04:00
|
|
|
with:
|
2021-08-09 17:00:14 -04:00
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: rustypaste-${{ env.RELEASE_VERSION }}-${{ matrix.TARGET }}.tar.gz*
|
|
|
|
file_glob: true
|
|
|
|
overwrite: true
|
|
|
|
tag: ${{ github.ref }}
|
2021-07-27 08:56:34 -04:00
|
|
|
|
|
|
|
publish-crates-io:
|
|
|
|
name: Publish on crates.io
|
|
|
|
needs: publish-github
|
2023-05-10 17:40:08 -04:00
|
|
|
runs-on: ubuntu-22.04
|
2021-07-27 08:56:34 -04:00
|
|
|
steps:
|
|
|
|
- name: Checkout the repository
|
2023-05-14 06:48:39 -04:00
|
|
|
uses: actions/checkout@v3
|
2021-07-27 08:56:34 -04:00
|
|
|
- name: Publish
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: publish
|
|
|
|
args: --locked --token ${{ secrets.CARGO_TOKEN }}
|