headscale/.github/workflows/build.yml

62 lines
1.8 KiB
YAML
Raw Normal View History

name: Build Docker images for PRs
on:
pull_request_target:
branches:
- main
concurrency:
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
2024-03-13 12:43:06 +00:00
- uses: actions/checkout@v4
2022-01-30 09:54:26 +00:00
with:
fetch-depth: 2
2022-01-30 09:49:15 +00:00
- name: Get changed files
id: changed-files
2024-03-13 12:43:06 +00:00
uses: dorny/paths-filter@v3
2022-01-30 09:49:15 +00:00
with:
2024-03-13 12:43:06 +00:00
filters: |
files:
- '*.nix'
- 'go.*'
- '**/*.go'
- 'integration_test/'
- 'config-example.yaml'
- '.ko.yaml'
- uses: DeterminateSystems/nix-installer-action@main
2024-03-13 12:43:06 +00:00
if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main
2024-03-13 12:43:06 +00:00
if: steps.changed-files.outputs.files == 'true'
# - uses: actions/github-script@v7
# id: get_pr_data
# with:
# script: |
# return (
# await github.rest.repos.listPullRequestsAssociatedWithCommit({
# commit_sha: context.sha,
# owner: context.repo.owner,
# repo: context.repo.repo,
# })
# ).data[0];
# - name: Pull Request data
# run: |
# echo '${{steps.get_pr_data.outputs.result}}'
- name: Run ko build
id: build
2024-03-13 12:43:06 +00:00
if: steps.changed-files.outputs.files == 'true'
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/headscale
# TAG_PR_NAME: pr-${{ fromJson(steps.get_pr_data.outputs.result).number }}
TAG_SHA: ${{ github.sha }}
run: |
nix develop --command -- ko build --sbom=none --tags=$TAG_SHA ./cmd/headscale