mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-08 23:08:50 +07:00
ci(pr-build): use pr.head.sha as default ref (#209)
This commit is contained in:
6
.github/workflows/pr-build.yml
vendored
6
.github/workflows/pr-build.yml
vendored
@ -33,4 +33,8 @@ jobs:
|
|||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
build:
|
build:
|
||||||
uses: daeuniverse/dae/.github/workflows/seed-build.yml@main
|
uses: daeuniverse/dae/.github/workflows/seed-build.yml@pr_build_fix
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
pr_build: true
|
||||||
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
|
30
.github/workflows/seed-build.yml
vendored
30
.github/workflows/seed-build.yml
vendored
@ -13,6 +13,18 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
default: ${{ github.ref }}
|
||||||
|
pr_build:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
pr_number:
|
||||||
|
type: number
|
||||||
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -62,19 +74,19 @@ jobs:
|
|||||||
- name: Get the version
|
- name: Get the version
|
||||||
id: get_version
|
id: get_version
|
||||||
env:
|
env:
|
||||||
REF: ${{ github.ref }}
|
REF: ${{ inputs.ref }}
|
||||||
|
PR: pr-${{ inputs.pr_number }}
|
||||||
run: |
|
run: |
|
||||||
if [[ "$REF" == "refs/tags/v"* ]]; then
|
|
||||||
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
|
||||||
version=${tag}
|
|
||||||
else
|
|
||||||
date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
|
date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
|
||||||
|
commit=$(echo ${REF} | cut -c1-6)
|
||||||
|
if [[ "${{ inputs.pr_build }}" == "true" ]]; then
|
||||||
|
count=$(git rev-list --count origin/main..HEAD)
|
||||||
|
else
|
||||||
count=$(git rev-list --count HEAD)
|
count=$(git rev-list --count HEAD)
|
||||||
commit=$(git rev-parse --short HEAD)
|
|
||||||
version="unstable-$date.r${count}.$commit"
|
|
||||||
fi
|
fi
|
||||||
echo "VERSION=$version" >> $GITHUB_OUTPUT
|
version="unstable-${date}.${PR}.r${count}.${commit}"
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
echo "VERSION=${version}" >> $GITHUB_OUTPUT
|
||||||
|
echo "VERSION=${version}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Show workflow information
|
- name: Show workflow information
|
||||||
id: get_filename
|
id: get_filename
|
||||||
|
Reference in New Issue
Block a user