mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Download artifact by ID, it isn't available in the workflow_run
This commit is contained in:
parent
a78cc5114c
commit
cab97b1a93
29
.github/workflows/preview-builds.yml
vendored
29
.github/workflows/preview-builds.yml
vendored
@ -17,9 +17,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Kinda jank way to grab the PR and run ID
|
# Kinda jank way to grab the PR and run ID and then download the artifact
|
||||||
# However, not sure a better way
|
# TODO: Move this code to our own mini-action
|
||||||
- name: Grab PR and run ID
|
- name: Grab PR & run ID and download the artifact
|
||||||
uses: actions/github-script@v5
|
uses: actions/github-script@v5
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
@ -38,21 +38,32 @@ jobs:
|
|||||||
`\nWORKFLOW_PR_ID=${match[1]}` +
|
`\nWORKFLOW_PR_ID=${match[1]}` +
|
||||||
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
|
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const download = await github.rest.actions.downloadArtifact({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
artifact_id: artifact.id,
|
||||||
|
archive_format: 'zip',
|
||||||
|
});
|
||||||
|
require('fs').writeFileSync(`${process.env.GITHUB_WORKSPACE}/preview.zip`, Buffer.from(download.data))
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download the artifact from the build workflow
|
# Unzip the artifact
|
||||||
- uses: actions/download-artifact@v3
|
- name: Unzip
|
||||||
with:
|
run: |
|
||||||
name: slimefun-${{ env.WORKFLOW_PR_ID }}
|
unzip preview.zip
|
||||||
|
rm preview.zip
|
||||||
|
mv 'Slimefun v4.9-UNOFFICIAL.jar' preview.jar
|
||||||
|
|
||||||
- name: Upload to preview service
|
- name: Upload to preview service
|
||||||
run: |
|
run: |
|
||||||
curl -v -X POST \
|
curl -v -X POST \
|
||||||
-H 'Authorization: ${{ secrets.PUBLISH_TOKEN }}' \
|
-H 'Authorization: ${{ secrets.PUBLISH_TOKEN }}' \
|
||||||
-H "X-Checksum: $(sha256sum 'target/Slimefun v4.9-UNOFFICIAL.jar' | awk '{print $1}')" \
|
-H "X-Checksum: $(sha256sum 'preview.jar' | awk '{print $1}')" \
|
||||||
--data-binary '@target/Slimefun v4.9-UNOFFICIAL.jar' \
|
--data-binary '@preview.jar' \
|
||||||
https://preview-builds.walshy.dev/upload/Slimefun/${{ env.WORKFLOW_PR_ID }}/${{ env.WORKFLOW_RUN_ID }}
|
https://preview-builds.walshy.dev/upload/Slimefun/${{ env.WORKFLOW_PR_ID }}/${{ env.WORKFLOW_RUN_ID }}
|
||||||
|
|
||||||
- name: Post comment
|
- name: Post comment
|
||||||
|
Loading…
Reference in New Issue
Block a user