Merge branch 'release-workflow-and-deb-package' into release/v0.8.0 #4
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: Release | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- v* | |
branches: | |
- release/* | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: "publish" | |
# Reference your environment variables | |
environment: cargo | |
steps: | |
- uses: actions/checkout@master | |
# Use caching to speed up your build | |
- name: Cache publish-action bin | |
id: cache-publish-action | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-publish-action | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: SET CURRENT_VERSION tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
branchName=$(echo $GITHUB_REF | sed 's/refs\/tags\///') | |
echo "CURRENT_VERSION=$(echo $branchName)" >> $GITHUB_ENV | |
- name: SET CURRENT_VERSION branch | |
if: startsWith(github.ref, 'refs/heads/') | |
run: | | |
branchName=$(echo $GITHUB_REF | sed 's/refs\/heads\/release\///') | |
echo "CURRENT_VERSION=$(echo $branchName)" >> $GITHUB_ENV | |
- name: Update local toolchain | |
run: | | |
rustup update | |
rustup component add clippy | |
rustup install stable | |
- name: Install cargo-deb | |
if: steps.cache-publish-action.outputs.cache-hit != 'true' | |
run: cargo install cargo-deb | |
- name: Run cargo publish libprotonup | |
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: cargo publish --dry-run -p libprotonup | |
- name: Run cargo build | |
run: cargo build --release | |
- name: Run cargo-deb to build a debian package | |
run: cargo-deb -p protonup-rs --deb-version $CURRENT_VERSION | |
- name: Upload deb package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: /app/target/debian/protonup-rs_$CURRENT_VERSION-1_amd64.deb | |
asset_name: /app/target/debian/protonup-rs_$CURRENT_VERSION-1_amd64.deb | |
tag: $CURRENT_VERSION | |
- 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 Tar gzed binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/release/protonup-rs-linux-amd64.tar.gz | |
asset_name: protonup-rs-linux-amd64.tar.gz | |
tag: $CURRENT_VERSION | |
- name: Upload Ziped binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/release/protonup-rs-linux-amd64.zip | |
asset_name: protonup-rs-linux-amd64.zip | |
tag: $CURRENT_VERSION | |
- 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: cargo publish --dry-run -p protonup-rs | |