mirror of
https://github.com/kerberos-io/agent.git
synced 2026-11-18 22:20:50 +00:00
Reduce the build job's contents permission to read and remove DockerHub authentication, since pull request builds only need to build the image locally.
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
name: Build pull request
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
|
|
env:
|
|
REPO: kerberos/agent
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- architecture: amd64
|
|
runner: ubuntu-24.04
|
|
- architecture: arm64
|
|
runner: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Run Build
|
|
run: |
|
|
docker build --build-arg VERSION=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) -t ${{ matrix.architecture }} .
|
|
CID=$(docker create ${{matrix.architecture}})
|
|
docker cp ${CID}:/home/agent ./output-${{matrix.architecture}}
|
|
docker rm ${CID}
|
|
- name: Strip binary
|
|
run: tar -cf agent-${{matrix.architecture}}.tar -C output-${{matrix.architecture}} . && rm -rf output-${{matrix.architecture}}
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: agent-${{matrix.architecture}}.tar
|
|
path: agent-${{matrix.architecture}}.tar
|