-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Draft Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
draft: | ||
name: Draft | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo | ||
- name: Define variables | ||
id: defvar | ||
run: | | ||
BRANCH=main | ||
API_URL="https://api.github.com/repos/${{ github.repository }}/actions/workflows/blank.yml/runs?per_page=1&branch=$BRANCH&status=success" | ||
RUN_ID=$(curl $API_URL | jq .workflow_runs[0].id) | ||
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT | ||
- name: Download artifacts | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('node:fs/promises'); | ||
const path = `${process.env.GITHUB_WORKSPACE}/artifacts`; | ||
await fs.mkdir(path, { recursive: true }); | ||
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{ steps.defvar.outputs.run_id }}, | ||
}); | ||
console.log(`Found ${allArtifacts.data.artifacts.length} artifacts!`); | ||
for (const artifact of allArtifacts.data.artifacts) { | ||
console.log(`Downloading ${artifact.name}`); | ||
const download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: artifact.id, | ||
archive_format: 'zip', | ||
}); | ||
await fs.writeFile(`${path}/${artifact.name}.zip`, Buffer.from(download.data)); | ||
} | ||
- name: Unzip Build | ||
run: | | ||
7z x "./artifacts/Build Output.zip" -o"./" | ||
- name: Get Info | ||
id: info | ||
run: python3 repo/.github/workflow-scripts/get-draft-info.py | ||
- name: Create Draft Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.info.outputs.version }} | ||
name: User Reviews v${{ steps.info.outputs.version }} | ||
body: ${{ steps.info.outputs.cl }} | ||
draft: true | ||
files: | | ||
./uproxide.more_difficulties.geode |