Skip to content

Refactor Permissions (#45) #34

Refactor Permissions (#45)

Refactor Permissions (#45) #34

Workflow file for this run

name: Publish
on:
push:
branches:
- main
workflow_dispatch:
jobs:
compile:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow_ref }}-${{ github.job }}
container: debian:bookworm-slim
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
cmake ninja-build \
clang libclang-rt-dev \
libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc \
libpq-dev postgresql-client
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.arch }}_${{ github.job }}-${{ hashFiles('cmake/dependencies.cmake') }}
- name: Build
run: |
cmake -B .build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build .build --config Release
- uses: actions/upload-artifact@v3
with:
name: binary_${{ runner.arch }}
path: .build/bin/gatekeeper
retention-days: 1
container:
needs: compile
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: binary_${{ runner.arch }}
path: ${{ runner.temp }}/${{ github.job }}/app/bin
- uses: actions/checkout@v3
- name: Prepare
run: |
cp -a conf ${{ runner.temp }}/${{ github.job }}/app
chmod +x ${{ runner.temp }}/${{ github.job }}/app/bin/gatekeeper
- name: Package
working-directory: ${{ runner.temp }}/${{ github.job }}
run: |
cat <<EOF > Dockerfile
FROM debian:bookworm-slim
RUN apt-get update \
&& \
apt-get install -y --no-install-recommends \
libpq5 libgrpc++1.51
COPY app /opt/gatekeeper
WORKDIR /opt/gatekeeper
ENTRYPOINT [ "bin/gatekeeper" ]
EXPOSE 7000
EOF
docker build --tag ghcr.io/${{ github.repository }}:latest .
- name: Publish
run: |
docker push ghcr.io/${{ github.repository }}:latest
- uses: actions/delete-package-versions@v4
with:
package-name: gatekeeper
package-type: container
min-versions-to-keep: 1
delete-only-untagged-versions: true