Skip to content

bump to 0.8.3 for release #15

bump to 0.8.3 for release

bump to 0.8.3 for release #15

Workflow file for this run

name: Release
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
name: "Build and Publish Release"
steps:
- uses: actions/checkout@master
- name: SET CURRENT_VERSION tag
run: |
branchName=$(echo $GITHUB_REF | sed 's/refs\/tags\///' )
# variable CURRENT_VERSION should not have the "v" used in the branch name
echo "CURRENT_VERSION=$(echo $branchName | sed 's/v//' )" >> $GITHUB_ENV
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
rustup install stable
- name: Install cargo-deb (generate DEB package)
run: cargo install cargo-deb
- name: Install Alien for RPM conversion
run: |
sudo apt-get update -y
sudo apt-get install -y alien dpkg-dev debhelper build-essential
- name: Run cargo publish libprotonup
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# retrieve available versions in crates.io api to skip upload if it was published already
published_versions=$( curl 'https://crates.io/api/v1/crates/libprotonup' -H 'Accept: */*' | jq '.versions[].num' )
exists=false
if [[ ${published_versions[@]} =~ $CURRENT_VERSION ]]
then
exists=true
fi
if ! ( $exists ) ; then
cargo publish -p libprotonup
fi
- name: Run cargo build
run: cargo build --release
- name: Run cargo-deb to build a debian package
run: cargo-deb -p protonup-rs --compress-type gzip --deb-version $CURRENT_VERSION
- name: Run Alient to convert the DEB package into a RPM package
run: |
cd target/debian
alien -k --to-rpm protonup-rs_${{ env.CURRENT_VERSION }}_amd64.deb
- name: Compress binary release artefacts
run: |
cd ./target/release
zip protonup-rs-linux-amd64.zip protonup-rs
tar -czvf protonup-rs-linux-amd64.tar.gz protonup-rs
- name: Upload Ziped,Tar gzed, DEB and RPM binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'target/{release,debian}/protonup-rs**.{gz,zip,rpm,deb}'
tag: v${{ env.CURRENT_VERSION }}
overwrite: true
file_glob: true
draft: true
- name: Run cargo publish binary
env:
# This can help you tagging the github repository
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This can help you publish to crates.io
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# retrieve available versions in crates.io api to skip upload if it was published already
published_versions=$( curl 'https://crates.io/api/v1/crates/Protonup-rs' -H 'Accept: */*' | jq '.versions[].num' )
exists=false
if [[ ${published_versions[@]} =~ $(echo $CURRENT_VERSION | sed 's/v//' ) ]]
then
exists=true
fi
if ! ( $exists ) ; then
cargo publish -p protonup-rs
fi