ci: container builds (#199) #72
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
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
force_publish: | |
type: boolean | |
description: >- | |
Force publish-crates. Note that if the current crate version is already | |
published, it will do nothing. | |
required: false | |
default: false | |
permissions: | |
contents: write | |
pull-requests: write | |
name: release-please | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
outputs: | |
releases_created: ${{ steps.release-please.outputs.releases_created }} | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 #v1.8.0 | |
with: | |
app_id: ${{ secrets.PR_AUTOMATION_APP_ID }} | |
private_key: ${{ secrets.PR_AUTOMATION_APP_PEM }} | |
- name: Release please | |
id: release-please | |
uses: google-github-actions/release-please-action@8016a6649226f2ec88ed05441c11bb5410a22d29 #v3.7.10 | |
with: | |
command: manifest | |
token: ${{ steps.generate_token.outputs.token }} | |
publish-crates: | |
runs-on: ubuntu-latest | |
# run only if release-please had released a new version | |
needs: release-please | |
if: needs.release-please.outputs.releases_created == 'true' || github.event.inputs.force_publish == 'true' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install cargo-workspaces | |
run: cargo install cargo-workspaces | |
- name: Publish workspace crates | |
# `--no-remove-dev-deps` is a workaround for https://github.com/pksunkara/cargo-workspaces/issues/103 | |
run: cargo workspaces publish --from-git --no-remove-dev-deps -y | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |