Skip to content

Commit

Permalink
build: some small fixes to CI (#27)
Browse files Browse the repository at this point in the history
- (hopefully) properly publish Docker images with versions on ghcr.io
- (hopefully) properly cache librocksdb-sys with rust-cache

Release-As: 0.1.6
  • Loading branch information
holtgrewe authored Jun 19, 2023
1 parent 42be77f commit 06177e7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This builds the containers with version tags. The `main` and `latest` tags are
# pushed in `docker-build.yml`.
name: Release Package/Image
name: Release

on:
push:
Expand All @@ -20,19 +20,25 @@ jobs:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_name: ${{ steps.release.outputs.release_name }}
steps:
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
release-type: rust
package-name: ${{ env.PACKAGE_NAME}}

cargo-release:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
if: ${{ needs.release-please.outputs.release_created }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
if: ${{ steps.release.outputs.release_created }}
if: ${{ needs.release-please.outputs.release_created }}
with:
toolchain: stable
override: true
Expand All @@ -43,10 +49,13 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2
if: ${{ steps.release.outputs.release_created }}
if: ${{ needs.release-please.outputs.release_created }}
with:
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*
- name: Publish crate
if: ${{ steps.release.outputs.release_created }}
if: ${{ needs.release-please.outputs.release_created }}
uses: actions-rs/cargo@v1
with:
command: publish
Expand Down Expand Up @@ -74,9 +83,9 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.release_name }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.release_name }}
type=semver,pattern={{major}},value=${{ needs.release-please.outputs.release_name }}
type=sha
- name: Build and push Docker image
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2
with:
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*
- name: Lint with clippy
uses: actions-rs/clippy-check@v1
with:
Expand All @@ -75,6 +80,9 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: Swatinem/rust-cache@v2
with:
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
Expand Down

0 comments on commit 06177e7

Please sign in to comment.