Skip to content

Release 🚢

Release 🚢 #51

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-[a-z]+"
workflow_dispatch:
inputs:
tag:
description: "The tag to release."
required: true
permissions:
id-token: write
contents: write
env:
RUSTC_WRAPPER: sccache
SCCACHE_S3_USE_SSL: ${{ secrets.CACHE_SSL }}
GIT_LFS_SKIP_SMUDGE: 1
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
SCCACHE_BUCKET: namada-cache
SCCACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }}
AWS_ACCESS_KEY_ID: ${{ secrets.CACHE_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CACHE_SECRET_KEY }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
make:
- name: Build package
command: package
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force origin # WA: https://github.com/actions/checkout/issues/882
- name: Switch to tag if specified
if: "${{ github.event.inputs.tag != '' }}"
run: git checkout ${{ github.event.inputs.tag }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: minimal
override: true
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Start sccache server
run: sccache --start-server
- name: Install cargo-about
if: "!startsWith(runner.os, 'Windows')"
run: curl -k https://installer.heliax.click/EmbarkStudios/[email protected]! | bash
- name: Install cargo-about (only windows)
if: startsWith(runner.os, 'Windows')
run: |
curl -L https://github.com/EmbarkStudios/cargo-about/releases/download/0.5.7/cargo-about-0.5.7-x86_64-pc-windows-msvc.tar.gz -o cargo-about
pwd
ls
echo $GITHUB_PATH
echo $env.GITHUB_PATH
echo GITHUB_WORKSPACE
echo $env.GITHUB_WORKSPACE
echo "${GITHUB_WORKSPACE}" >> $env.GITHUB_PATH
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
GITHUB_WORKSPACE: ${{ github.workspace }}
- name: ${{ matrix.make.name }}
run: make ${{ matrix.make.command }}
- name: Upload binaries package
uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.os }}-${{ github.sha }}
path: ./*.tar.gz
- name: Print sccache stats
if: always()
run: sccache --show-stats || true
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
- name: Clean cargo cache
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
cargo-cache
release:
needs: build
runs-on: ${{ matrix.os }}
if: success() || failure()
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
steps:
- id: get_version
uses: battila7/get-version-action@v2
- name: Download release artifacts
uses: actions/download-artifact@v3
- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: true
files: ./**/*.tar.gz
tag_name: ${{ steps.get_version.outputs.version }}
name: Namada ${{ steps.get_version.outputs.version-without-v }}