mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
* Add rust_build_next job to test upcoming Rust versions This way, build failures on a upcoming Rust version can be found earlier, and doesn't hold new Kanidm releases. * yamlllinttttt the GitHub workflows --------- Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
92 lines
2.8 KiB
YAML
92 lines
2.8 KiB
YAML
---
|
|
name: Container - Kanidmd
|
|
|
|
# This is always built and uploads an OCI image as a build artifact, but only
|
|
# pushes to "ghcr.io/kanidm/kanidmd:devel" when on "kanidm/kanidm@master".
|
|
"on":
|
|
pull_request:
|
|
push:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
set_lower_case_name:
|
|
runs-on: ubuntu-latest
|
|
name: set lower case owner name
|
|
steps:
|
|
- id: step1
|
|
run: |
|
|
echo "OWNER_LC=${OWNER,,}" >> "${GITHUB_OUTPUT}"
|
|
env:
|
|
OWNER: '${{ github.repository_owner }}'
|
|
outputs:
|
|
owner_lc: ${{ steps.step1.outputs.OWNER_LC }}
|
|
|
|
kanidmd_build:
|
|
name: Build kanidmd Docker image
|
|
runs-on: ubuntu-latest
|
|
needs: set_lower_case_name
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
# list of Docker images to use as base name for tags
|
|
# images: |
|
|
# kanidm/kanidmd
|
|
# ghcr.io/username/app
|
|
# generate Docker tags based on the following events/attributes
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
|
|
- name: Build kanidmd
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: "linux/amd64"
|
|
tags: ghcr.io/${{ needs.set_lower_case_name.outputs.owner_lc }}/kanidmd:devel
|
|
# build-args: |
|
|
# "KANIDM_BUILD_OPTIONS=-j1"
|
|
file: server/Dockerfile
|
|
# Must use OCI exporter for multi-arch: https://github.com/docker/buildx/pull/1813
|
|
outputs: type=oci,dest=/tmp/kanidmd-docker.tar
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kanidmd-docker
|
|
path: /tmp/kanidmd-docker.tar
|
|
|
|
kanidmd_push:
|
|
name: Push kanidmd Docker image
|
|
# This step is split so that we don't apply "packages: write" permission
|
|
# except when uploading the final Docker image to GHCR.
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm'
|
|
needs: kanidmd_build
|
|
permissions:
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: kanidmd-docker
|
|
path: /tmp
|
|
|
|
- name: Push image to GHCR
|
|
run: |
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | \
|
|
oras login -u "${{ github.actor }}" --password-stdin ghcr.io
|
|
oras copy --from-oci-layout "/tmp/kanidmd-docker.tar:devel" \
|
|
"ghcr.io/${{ github.repository_owner }}/kanidmd:devel"
|