Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco committed Mar 28, 2024
1 parent 0b1c29c commit 85c3907
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ csharp_new_line_before_members_in_anonymous_types = true
[*.csproj]
indent_size = 2

[*.js]
indent_size = 2

[*.json]
indent_size = 2

Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- run: build\build.ps1
- run: scripts\build.ps1
- uses: actions/upload-artifact@v4
with:
name: nuget
Expand All @@ -28,6 +28,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
Expand All @@ -37,16 +38,5 @@ jobs:
- uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag_name = context.ref.replace(/refs\/tags\//, '');
github.rest.repos.createRelease({
owner,
repo,
tag_name,
name: "Release " + tag_name,
body: "TODO",
draft: true,
});
const script = require('./scripts/create-release.js')
script({github, context})
File renamed without changes.
36 changes: 36 additions & 0 deletions scripts/create-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const fs = require("fs").promises;
const path = require("path");

const ARTIFACTS_PATH = "./artifacts";

const createRelease = async ({github, context}) => {
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag_name = context.ref.replace(/refs\/tags\//, '');

const res = github.rest.repos.createRelease({
owner,
repo,
tag_name,
name: "Release " + tag_name,
body: "TODO",
draft: true,
});

const artifacts = await fs.readdir(ARTIFACTS_PATH);

for (let artifact of artifacts) {
const artifactPath = path.join(ARTIFACTS_PATH, artifact);
const data = await fs.readFile(artifactPath);

await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: res.data.id,
name: artifact,
data
});
}
}

module.exports = createRelease;

0 comments on commit 85c3907

Please sign in to comment.