Skip to content

Commit

Permalink
Create draft.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Uproxide authored Jun 11, 2024
1 parent 5451be7 commit e869ada
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/draft.yml
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

0 comments on commit e869ada

Please sign in to comment.