mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 13:35:23 +00:00
53a08e5ab6
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Build Docker images for PRs
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
files:
|
|
- '*.nix'
|
|
- 'go.*'
|
|
- '**/*.go'
|
|
- 'integration_test/'
|
|
- 'config-example.yaml'
|
|
- '.ko.yaml'
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
|
if: steps.changed-files.outputs.files == 'true'
|
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
|
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 '${{ fromJson(steps.get_pr_data.outputs.result).number }}'
|
|
echo '${{ fromJson(steps.get_pr_data.outputs.result).title }}'
|
|
echo '${{steps.get_pr_data.outputs.result}}'
|
|
|
|
- name: Run ko build
|
|
id: build
|
|
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: |
|
|
echo $TAG_PR_NAME
|
|
ko build --tags=$TAG_SHA ./cmd/headscale
|