Github Asset Release #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: Github Asset Release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
BINARY_ROOT_PATH: ockam_ebpf_impl | |
jobs: | |
release: | |
runs-on: ubuntu-20.04 | |
environment: release | |
steps: | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9 | |
- name: Checkout Repository | |
uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb | |
- name: Update Version in Cargo.toml | |
shell: nix shell nixpkgs#rustup nixpkgs#cargo nixpkgs#cargo-edit nixpkgs#gh --command bash {0} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git checkout -b "$release_name" | |
cargo set-version --bump minor | |
gh auth setup-git | |
git add --all | |
release_name="release_$(date +'%d-%m-%Y')_$(date +'%s')" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Bump crate version" | |
# Create a new branch with the version bump | |
git push origin "$release_name" | |
- name: Get Latest Version Of Ockam Draft | |
shell: nix shell nixpkgs#toml2json nixpkgs#jq --command bash {0} | |
run: | | |
ockam_version=$(toml2json Cargo.toml | jq -r '.package.version') | |
echo "Latest version of Ockam is $ockam_version" | |
echo "ockam_version=$ockam_version" >> $GITHUB_ENV | |
- name: Build ockam_ebpf crate | |
shell: nix shell nixpkgs#llvm nixpkgs#rustup nixpkgs#cargo --command bash {0} | |
working-directory: ${{ env.BINARY_ROOT_PATH }} | |
run: | | |
rustup install stable | |
rustup toolchain install nightly --component rust-src | |
cargo install bpf-linker | |
cargo build --release | |
- name: Create Release | |
working-directory: ${{ env.BINARY_ROOT_PATH }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Creating release ${{ env.ockam_version }}" | |
gh release create ${{ env.ockam_version }} ./target/bpfel-unknown-none/release/ockam_ebpf -t ${{ env.ockam_version }} -n "Release ${{ env.ockam_version }}" |