generated from finos/standards-project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 44
106 lines (92 loc) · 3.29 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Release Workflow
on:
workflow_dispatch:
inputs:
build_target:
description: "Build Target (e.g storage/object)"
required: true
tag:
description: "Tag for this release"
required: true
# TODO: Add in pre-release tag to distinguish whether or not we want to have an official release
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./delivery-toolkit
steps:
- uses: actions/checkout@v4
name: Build
- name: Configure Go
uses: actions/setup-go@v5
- name: Install dependencies
run: go mod download
- name: Get Build Target
id: process_target
run: |
# Read the input for a single build target
build_target="${{ github.event.inputs.build_target }}"
# Print and save the build target
echo "Build target: $build_target"
echo "target=$build_target" >> $GITHUB_OUTPUT
- name: Create Release Artifacts
run: |
# Create all artifacts for the specified build target
build_target="${{ steps.process_target.outputs.target }}"
echo "Creating Artifacts for: $build_target"
go run . "yaml" --build-target $build_target
go run . "md" --build-target $build_target
go run . "release-notes" --build-target $build_target
# Create PDF files from MD files
echo "Converting MD file to PDF"
for md_file in ./artifacts/*.md; do
filename=$(basename "$md_file" .md)
# Check if the filename contains "release-notes"
if [[ $filename != *"release_notes"* ]]; then
echo "Converting $md_file to $filename.pdf"
docker run --rm -v "$PWD:/app" jmaupetit/md2pdf "./artifacts/$filename.md" "./artifacts/$filename.pdf"
else
echo "Skipping $md_file as it contains 'release-notes'"
fi
done
- name: Upload Artifacts
uses: actions/upload-artifact@v4.4.0
with:
name: ccc-catalogs
path: ./delivery-toolkit/artifacts/*
if-no-files-found: error
retention-days: 1 # Maximum Retention
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4.1.8
with:
name: ccc-catalogs
# Create a GitHub release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
body_path: ./release_notes.md
tag_name: ${{ github.event.inputs.tag }}-rc
release_name: Release ${{ github.event.inputs.tag }}-rc
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload the artifacts to the release
- name: Upload Release Assets
run: |
for file in ./*
do
echo "Uploading $file"
filename=$(basename "$file")
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file" \
"${{ steps.create_release.outputs.upload_url }}=$filename&label=$filename"
done