Skip to content

Commit e43974b

Browse files
authored
Add Gem publishing steps in udp exporter release workflow (#148)
* add actual publishing steps in udp exporter release workflow * add gh release step * add release notes
1 parent 0477c3f commit e43974b

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

.github/workflows/release-udp-exporter.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release ADOT X-Ray UDP Exporter
22
on:
33
workflow_dispatch:
44
inputs:
5-
version:
5+
udp-exporter-version:
66
description: The version to tag the release with, e.g., 1.2.0
77
required: true
88

@@ -11,6 +11,7 @@ env:
1111

1212
permissions:
1313
id-token: write
14+
contents: write
1415

1516
jobs:
1617
validate-udp-exporter-e2e-test:
@@ -38,9 +39,48 @@ jobs:
3839
cache-version: "v1-ruby-xray-udp"
3940

4041
- name: Run Unit Tests
42+
working-directory: "exporter/xray-udp"
4143
run: |
42-
cd exporter/xray-udp
4344
bundle install
4445
bundle exec rake test
4546
46-
# TODO: Publish OTLP UDP Exporter to RubyGems
47+
- name: Build gem
48+
working-directory: "exporter/xray-udp"
49+
run: |
50+
gem build aws-distro-opentelemetry-exporter-xray-udp.gemspec
51+
52+
- name: Validate gem version matches workflow input
53+
working-directory: "exporter/xray-udp"
54+
run: |
55+
if [[ ! -f aws-distro-opentelemetry-exporter-xray-udp-${{ inputs.udp-exporter-version }}.gem ]]; then
56+
echo "Input version '${{ inputs.udp-exporter-version }}' does not match with UDP Exporter gem version"
57+
exit 1
58+
fi
59+
60+
- name: Set API key credentials
61+
run: |
62+
mkdir -p $HOME/.gem
63+
touch $HOME/.gem/credentials
64+
chmod 0600 $HOME/.gem/credentials
65+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
66+
env:
67+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_UDP_EXPORTER_API_KEY }}
68+
69+
- name: Push gem
70+
working-directory: "exporter/xray-udp"
71+
run: gem push aws-distro-opentelemetry-exporter-xray-udp-${{ inputs.udp-exporter-version }}.gem
72+
73+
- name: Clear credentials
74+
run: rm -f ~/.gem/credentials
75+
76+
# Publish to GitHub releases
77+
- name: Create GH release
78+
id: create_release
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
81+
run: |
82+
gh release create --target "$GITHUB_REF_NAME" \
83+
--title "Release aws-distro-opentelemetry-exporter-xray-udp v${{ inputs.udp-exporter-version }}" \
84+
--notes "Please refer to the [Changelog](https://github.com/aws-observability/aws-otel-ruby/blob/main/exporter/xray-udp/CHANGELOG.md) for more details" \
85+
--draft \
86+
"v${{ inputs.udp-exporter-version }}"

0 commit comments

Comments
 (0)