Skip to content

Commit

Permalink
ci: build & push container after the release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidB committed Dec 12, 2024
1 parent f944772 commit f281f02
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: jdx/mise-action@v2
- run: mise install
shell: bash
- run: mise run ci
- run: mise run --jobs 1 ci
shell: bash
- run: ${SCCACHE_PATH} --show-stats
shell: bash
43 changes: 43 additions & 0 deletions .github/workflows/release-after.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release-after

on:
workflow_call:
inputs:
plan:
required: true
type: string
workflow_dispatch:
inputs:
plan:
description: plan json (eg {"releases":[{"app_version":"0.2.1"}]}) to extract version
required: true
type: string

jobs:
container-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: version
shell: bash
run: |
cat >plan.json << EOF
{{ inputs.plan }}
EOF
VERSION=$(yq -r '.releases[0].app_version' < plan.json)
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
push: true
build-args: VERSION=${{ steps.version.outputs.VERSION }}
platforms: linux/amd64,linux/arm64
target: cdviz-collector
tags: ghcr.io/cdviz-dev/cdviz-collector:${{ steps.version.outputs.VERSION }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

custom-release-after:
needs:
- plan
- announce
uses: ./.github/workflows/release-after.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
version = "0.2.1"
authors = ["David Bernard"]
license = "Apache-2.0"
homepage = "https://cdviz.dev"
repository = "https://github.com/cdviz-dev/cdviz-collector"
rust-version = "1.83.0"
publish = true
Expand Down
15 changes: 8 additions & 7 deletions dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ installers = ["shell", "homebrew"]
# A GitHub repo to push Homebrew formulas to
tap = "cdviz-dev/homebrew-tap"
# Target platforms to build apps for (Rust target-triple syntax)
targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-musl",
"x86_64-unknown-linux-musl",
"x86_64-pc-windows-msvc",
]
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-musl", "x86_64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
# Path that installers should place binaries in
install-path = "CARGO_HOME"
# Publish jobs to run in CI
publish-jobs = ["homebrew"]
# Whether to install an updater program
install-updater = false
# Post-announce jobs to run in CI
post-announce-jobs = ["./release-after"]

# [dist.github-custom-runners]
# buildjet could be used to build the binaries (faster, cheaper? than github's runners)
# aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm"
# aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm"

0 comments on commit f281f02

Please sign in to comment.