Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/runfiles_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Release Runfiles
on:
workflow_dispatch:
push:
branches:
- main
paths:
- rust/runfiles/Cargo.toml

defaults:
run:
shell: bash

jobs:
validation:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# TODO: Unfortunately it's not obvious how to restrict `workflow_dispatch` to a particular branch
# so this step ensures releases are always done off of `main`.
- name: Ensure branch is 'main'
run: |
git fetch origin &> /dev/null
branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${branch}" != "main" ]]; then
echo "The release branch must be main. Got '${branch}'' instead." >&2
exit 1
else
echo "Branch is '${branch}'"
fi
builds:
needs: validation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install rust toolchains for host
run: |
# Detect the current version of rust
version="$(grep 'DEFAULT_RUST_VERSION =' ./rust/private/common.bzl | grep -o '[[:digit:].]\+')"
rustup override set "${version}"
rustup update stable && rustup default stable
- name: Publish to crates.io
run: cargo publish --token ${CRATES_TOKEN}
working-directory: ./rust/runfiles
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
11 changes: 11 additions & 0 deletions rust/runfiles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "runfiles"
version = "0.1.0"
edition = "2018"
keywords = ["bazel"]
license = "Apache-2.0"
description = "Runfiles lookup library for Bazel-built Rust binaries and tests."
repository = "https://github.com/bazelbuild/rules_rust"

[lib]
path = "runfiles.rs"
Loading