Skip to content

Merge pull request #402 from code0-tech/#401-warn-if-missing-module #64

Merge pull request #402 from code0-tech/#401-warn-if-missing-module

Merge pull request #402 from code0-tech/#401-warn-if-missing-module #64

Workflow file for this run

name: Publish YML
on:
push:
tags:
- 'cli-*'
- 'def-*'
jobs:
publish-definitions:
permissions:
contents: write
packages: read
if: startsWith(github.ref, 'refs/tags/def-')
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
# Shared with the producer builds `poll` kicks off below: they are
# separate cargo projects in a scratch directory, but they resolve
# against this same registry and git checkout cache.
- name: Cache cargo registry
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-publish-definitions-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# Assembles ./definitions by cloning every producer in collector.toml at
# its pinned ref and running its export. Nothing is read from this
# repository -- the definitions live in taurus and the centaurus actions,
# and only exist as files once this step has run.
- name: Poll definitions from the producers
run: cargo run -- poll
# A producer only ever sees its own modules, so cross-module references
# (an action pointing at a taurus data type) cannot be checked until the
# whole set is assembled. This is the only place that validation is
# possible, which is why it gates the release rather than each producer's
# own CI.
- name: Validate the assembled definitions
run: cargo run -- report
- name: Generate published definitions
run: |
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#*-}" # removes everything up to the first dash
cargo run -- publish --version "$VERSION" --path definitions --out out --compact
rm -rf definitions
mv out definitions
- name: Archive definitions folder
run: |
zip -r definitions.zip definitions
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
files: |
definitions.zip
generate_release_notes: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
publish-cli:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/cli-')
defaults:
run:
working-directory: "./cli"
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Set version
run: |
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^cli-//')
sed -i "s/version = \"0.0.0\"/version = \"$VERSION\"/" Cargo.toml
- name: Cargo Login
run: cargo login ${{secrets.CRATES_IO_PUBLISH}}
- name: Publish crate
run: cargo publish --allow-dirty