Skip to content

Commit

Permalink
Try to get the automated release CI in shape
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Jul 15, 2023
1 parent 11bc3e9 commit fe41120
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
run: cargo fmt --all -- --check

- name: Test Debug
run: cargo test --workspace --all-features
run: cargo test --workspace --all-features --locked

- name: Test Release
run: cargo test --workspace --release --all-features
run: cargo test --workspace --release --all-features --locked

- name: Lint
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

- name: Test docs
run: |
cargo test --workspace --release --doc
cargo test --workspace --release --doc --locked
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --release --no-deps
66 changes: 39 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
on:
release:
types: [ published ]
types: [published]

name: Cargo Publish

jobs:
publish:
if: false
name: Publish with ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: linux.x86_64
- os: macos-latest
target: macos

runs-on: ${{ matrix.os }}
publish_crate:
name: Cargo Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Use Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Publish crate
run: |
TAG_NAME=${{ github.event.release.tag_name }}
PREFIX=$(echo $TAG_NAME | cut -d'-' -f1)
case "$PREFIX" in
"sdf")
CRATE_NAME="sdf_glyph_renderer"
;;
"tools")
CRATE_NAME="pbf_font_tools"
;;
"cli")
CRATE_NAME="build_pbf_glyphs"
;;
*)
echo "Invalid prefix in tag: $PREFIX"
exit 1
esac
cd $CRATE_NAME
cargo publish --all-features
- name: Publish
uses: actions-rs/cargo@v1
env:
Expand All @@ -34,9 +43,18 @@ jobs:
command: publish
args: --all-features

build:
name: Build Binaries with ${{ matrix.os }}
if: false
publish_cli_binary:
name: Release build with ${{ matrix.os }}
if: startsWith(github.event.release.tag_name, 'cli-')
strategy:
fail-fast: true
# TODO: Not sure I agree with this setup of different runners; seems like we should use cross or something
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
Expand All @@ -51,12 +69,6 @@ jobs:
command: build
args: --all-features --release
- name: Push Artifacts
run: gh release upload $GITHUB_REF_NAME target/release/build_pbf_glyphs#build_pbf_glyphs.${{ matrix.target }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Publish on Release
# if: github.event.release.published == true
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# run: cargo publish -p pbf_font_tools --all-features
run: |
mv target/release/build_pbf_glyphs target/release/build_pbf_glyphs.${{ matrix.target }}
gh release upload ${{ github.event.release.tag_name }} target/release/build_pbf_glyphs.${{ matrix.target }}
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Always release `sdf_glyph_renderer` first.
Create releases with tags according to the following convention.

* `sdf-vX.Y.Z` for `sdf_glyph_renderer` releases. Release this before other crates.
* `tools-vX.Y.Z` for `pbf_fost_tools` releases. Release this next.
* `tools-vX.Y.Z` for `pbf_font_tools` releases. Release this next.
* `cli-vX.Y.Z` for `build_pbf_glyphs` releases. Release this last.

0 comments on commit fe41120

Please sign in to comment.