-
Notifications
You must be signed in to change notification settings - Fork 4
160 lines (136 loc) · 5.56 KB
/
releases.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "Publish release"
run-name: >
${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }}
on:
workflow_dispatch:
inputs:
workflow_id:
description: |
Workflow Run ID from this repository to fetch artifacts from for this
release.
required: true
type: string
defaults:
run:
shell: bash
jobs:
get-version:
name: Get application version info for this revision
runs-on: ubuntu-latest
outputs:
git-sha: ${{ steps.get-version.outputs.git-sha }}
otc-version: ${{ steps.set-versions.outputs.otc_version }}
otc-build-number: ${{ steps.set-versions.outputs.otc_build_number }}
otc-sumo-version: ${{ steps.set-versions.outputs.otc_sumo_version }}
package-version: ${{ steps.set-versions.outputs.package_version }}
binary-version: ${{ steps.set-versions.outputs.binary_version }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Outuput Workflow ID
run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }}
- name: Output Workflow URL
run: |
repo_url="https://github.com/SumoLogic/sumologic-otel-collector-packaging"
url="${repo_url}/actions/runs/${{ inputs.workflow_id }}"
echo ::notice title=Workflow URL::${url}
- name: Download version artifacts from workflow
uses: actions/download-artifact@v4
with:
pattern: "*.txt"
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Set version outputs
id: set-versions
run: |
otc_version="$(cat artifacts/otc-version.txt)"
otc_build_number="$(cat artifacts/otc-build-number.txt)"
otc_sumo_version="$(cat artifacts/otc-sumo-version.txt)"
echo otc_version="${otc_version}" >> $GITHUB_OUTPUT
echo otc_build_number="${otc_build_number}" >> $GITHUB_OUTPUT
echo otc_sumo_version="${otc_sumo_version}" >> $GITHUB_OUTPUT
echo package_version="${otc_version}-${otc_build_number}" >> $GITHUB_OUTPUT
echo binary_version="${otc_version}-sumo-${otc_sumo_version}" >> $GITHUB_OUTPUT
- name: Output OTC Version
run: |
version="${{ steps.set-versions.outputs.otc_version }}"
echo ::notice title=OTC Version::${version}
- name: Output OTC Build Number
run: |
version="${{ steps.set-versions.outputs.otc_build_number }}"
echo ::notice title=OTC Build Number::${version}
- name: Output OTC Sumo Version
run: |
version=${{ steps.set-version.outputs.otc_sumo_version }}
echo ::notice title=OTC Sumo Version::${version}
- name: Determine Git SHA of workflow
id: get-sha
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
workflow=${{ inputs.workflow_id }}
sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')"
echo "git-sha=$sha" >> $GITHUB_OUTPUT
- name: Output Git SHA
run: |
echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }}
# Store the install script from the packaging repository as a release
# artifact.
install-script:
name: Store install script
runs-on: ubuntu-latest
needs:
- get-version
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.get-version.outputs.git-sha }}
- name: Store Linux install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.sh
path: ./install-script/install.sh
if-no-files-found: error
- name: Store Windows install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.ps1
path: ./install-script/install.ps1
if-no-files-found: error
create-release:
name: Create Github release
runs-on: ubuntu-20.04
needs:
- get-version
permissions:
contents: write
steps:
- name: Download all artifacts from workflow
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: List all artifacts
run: ls -l artifacts/
- uses: ncipollo/release-action@v1
with:
name: v${{ needs.get-version.outputs.package-version }}
commit: ${{ needs.get-version.outputs.git-sha }}
tag: v${{ needs.get-version.outputs.package-version }}
draft: true
generateReleaseNotes: true
prerelease: false
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifacts: "artifacts/*"
artifactErrorsFailBuild: true
replacesArtifacts: false
body: |
This release packages Sumo Logic Distributions for OpenTelemetry Collector [${{ needs.get-version.outputs.binary-version }}](https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.binary-version }}).
The changelog below is for the package itself, rather than the Sumo Logic Distribution for OpenTelemetry Collector. The changelog for the Sumo Logic Distribution for OpenTelemetry Collector can be found on the collector's [release page](https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.binary-version }}).