Fix Output File Names for PR Test Builds (#471)
[COMBINE] commits = ["fbd1584e7baed4a3603e3c810066603185f1b230"] [COMBINE]
This commit is contained in:
parent
b15494c8bf
commit
d9909efcbf
8
.github/workflows/buildpack.yml
vendored
8
.github/workflows/buildpack.yml
vendored
@ -70,6 +70,12 @@ on:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
head_ref:
|
||||
type: string
|
||||
required: false
|
||||
true_sha:
|
||||
type: string
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -78,6 +84,8 @@ jobs:
|
||||
env:
|
||||
GITHUB_TAG: ${{ inputs.tag }}
|
||||
RELEASE_TYPE: ${{ inputs.release_type }}
|
||||
GITHUB_HEAD_REF: ${{ inputs.head_ref }}
|
||||
TRUE_SHA: ${{ inputs.true_sha }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Ref
|
||||
|
3
.github/workflows/forkprbuildpack.yml
vendored
3
.github/workflows/forkprbuildpack.yml
vendored
@ -22,6 +22,9 @@ jobs:
|
||||
name: Fork PR Build Pack
|
||||
runs-on: ubuntu-latest
|
||||
environment: fork-pr-build-pack
|
||||
env:
|
||||
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
||||
TRUE_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
steps:
|
||||
- name: Checkout Ref
|
||||
uses: actions/checkout@v4
|
||||
|
2
.github/workflows/testbuildpack.yml
vendored
2
.github/workflows/testbuildpack.yml
vendored
@ -21,5 +21,7 @@ jobs:
|
||||
uses: ./.github/workflows/buildpack.yml
|
||||
with:
|
||||
separate_upload: true
|
||||
head_ref: ${{ github.head_ref }}
|
||||
true_sha: ${{ github.event.pull_request.head.sha }}
|
||||
secrets: inherit
|
||||
|
||||
|
@ -8,7 +8,12 @@ export default async function transformManifestVersion(): Promise<void> {
|
||||
if (process.env.GITHUB_TAG) {
|
||||
modpackManifest.version = process.env.GITHUB_TAG.replace(/^v/, "");
|
||||
}
|
||||
// If SHA is provided and the build isn't tagged, append both the branch and short SHA.
|
||||
// If Pull Request Branch Name is provided and a 'True SHA' is provided
|
||||
else if (process.env.GITHUB_HEAD_REF && process.env.TRUE_SHA) {
|
||||
const shortCommit = process.env.TRUE_SHA.substring(0, 7);
|
||||
modpackManifest.version = `${process.env.GITHUB_HEAD_REF}-${shortCommit}`;
|
||||
}
|
||||
// If SHA and ref is provided, append both the branch and short SHA.
|
||||
else if (process.env.GITHUB_SHA && process.env.GITHUB_REF && process.env.GITHUB_REF.startsWith("refs/heads/")) {
|
||||
const shortCommit = process.env.GITHUB_SHA.substring(0, 7);
|
||||
const branch = /refs\/heads\/(.+)/.exec(process.env.GITHUB_REF)?.[1];
|
||||
|
@ -189,7 +189,12 @@ export function makeArtifactNameBody(baseName: string): string {
|
||||
if (process.env.GITHUB_TAG) {
|
||||
return `${baseName}-${process.env.GITHUB_TAG}`;
|
||||
}
|
||||
// If SHA is provided and the build isn't tagged, append both the branch and short SHA.
|
||||
// If Pull Request Branch Name is provided and a 'True SHA' is provided
|
||||
else if (process.env.GITHUB_HEAD_REF && process.env.TRUE_SHA) {
|
||||
const shortCommit = process.env.TRUE_SHA.substring(0, 7);
|
||||
return `${baseName}-${process.env.GITHUB_HEAD_REF}-${shortCommit}`;
|
||||
}
|
||||
// If SHA and ref is provided, append both the branch and short SHA.
|
||||
else if (process.env.GITHUB_SHA && process.env.GITHUB_REF && process.env.GITHUB_REF.startsWith("refs/heads/")) {
|
||||
const shortCommit = process.env.GITHUB_SHA.substring(0, 7);
|
||||
const branch = /refs\/heads\/(.+)/.exec(process.env.GITHUB_REF);
|
||||
|
Loading…
x
Reference in New Issue
Block a user