mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 21:44:55 +07:00
ci(pr-build): use pr.head.sha as default ref (#209)
This commit is contained in:
parent
acfc1db679
commit
39ddd480f9
6
.github/workflows/pr-build.yml
vendored
6
.github/workflows/pr-build.yml
vendored
@ -33,4 +33,8 @@ jobs:
|
||||
secrets: inherit
|
||||
|
||||
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:
|
||||
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:
|
||||
build:
|
||||
@ -62,19 +74,19 @@ jobs:
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
env:
|
||||
REF: ${{ github.ref }}
|
||||
REF: ${{ inputs.ref }}
|
||||
PR: pr-${{ inputs.pr_number }}
|
||||
run: |
|
||||
if [[ "$REF" == "refs/tags/v"* ]]; then
|
||||
tag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
version=${tag}
|
||||
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
|
||||
date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
|
||||
count=$(git rev-list --count HEAD)
|
||||
commit=$(git rev-parse --short HEAD)
|
||||
version="unstable-$date.r${count}.$commit"
|
||||
fi
|
||||
echo "VERSION=$version" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
version="unstable-${date}.${PR}.r${count}.${commit}"
|
||||
echo "VERSION=${version}" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=${version}" >> $GITHUB_ENV
|
||||
|
||||
- name: Show workflow information
|
||||
id: get_filename
|
||||
|
Loading…
Reference in New Issue
Block a user