-
Notifications
You must be signed in to change notification settings - Fork 52
62 lines (53 loc) · 2.02 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Release
on:
push:
tags:
- '*'
jobs:
build:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Pull code
uses: actions/checkout@v4
- name: Use .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build packages
run: |
set -xe
source_directory=src
release_directory=releases
pack_flags="--configuration Release --output $release_directory /p:ContinuousIntegrationBuild=true"
dotnet pack $pack_flags "$source_directory\\Chr.Avro"
dotnet pack $pack_flags "$source_directory\\Chr.Avro.Binary"
dotnet pack $pack_flags "$source_directory\\Chr.Avro.Cli"
dotnet pack $pack_flags "$source_directory\\Chr.Avro.Codegen"
dotnet pack $pack_flags "$source_directory\\Chr.Avro.Confluent"
dotnet pack $pack_flags "$source_directory\\Chr.Avro.Json"
shell: bash
- name: Draft GitHub release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs').promises;
const releaseDirectory = './releases';
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
// strip refs/tags/ prefix if present, otherwise release download links break:
tag_name: process.env.GITHUB_REF.replace(/^(?:.+\/)?([^\/]+)$/, '$1'),
target_commitish: context.sha,
// maintainer will add notes and publish:
draft: true
});
await Promise.all((await fs.readdir(releaseDirectory)).map(async file => {
await github.rest.repos.uploadReleaseAsset({
data: await fs.readFile(`${releaseDirectory}/${file}`),
name: file,
owner: context.repo.owner,
release_id: release.data.id,
repo: context.repo.repo
});
}));