-
Notifications
You must be signed in to change notification settings - Fork 600
75 lines (61 loc) · 2.95 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
name: Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
repository-projects: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7
with:
fetch-depth: 0
- uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # tag v1.207.0
with:
ruby-version: 3.4
- name: Install onetimepass
run: pip install onetimepass==1.0.1
- name: Configure gem credentials
run: |
echo "GEM_HOST_API_KEY=${{ secrets.RUBYGEMS_API_KEY }}" >> $GITHUB_ENV
echo "RUBYGEMS_MFA_KEY=${{ secrets.RUBYGEMS_MFA_KEY }}" >> $GITHUB_ENV
- name: Build newrelic_rpm gem
run: gem build newrelic_rpm.gemspec
- name: Build newrelic-infinite_tracing gem
run: |
cd infinite_tracing
gem build newrelic-infinite_tracing.gemspec
cd ..
- name: Determine version
run: |
echo "VERSION=$(ls newrelic_rpm-*.gem | ruby -pe 'sub(/newrelic_rpm\-(.*).gem/, "\\1")')" >> $GITHUB_ENV
- name: Create github release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # tag v2.0.8
if: $(git tag -l ${{ env.VERSION }}) == false
with:
tag_name: ${{ env.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Obtain OTP to publish newrelic_rpm to rubygems.org
run: echo "RUBYGEMS_OTP=$(python ./.github/workflows/scripts/rubygems-authenticate.py RUBYGEMS_MFA_KEY)" >> $GITHUB_ENV
- name: Publish newrelic_rpm to rubygems.org
run: ruby ./.github/workflows/scripts/rubygems-publish.rb newrelic_rpm
- name: Obtain OTP to publish newrelic-infinite_tracing to rubygems.org
run: echo "RUBYGEMS_OTP=$(python ./.github/workflows/scripts/rubygems-authenticate.py RUBYGEMS_MFA_KEY)" >> $GITHUB_ENV
- name: Publish newrelic-infinite_tracing to rubygems.org
run: ruby ./.github/workflows/scripts/rubygems-publish.rb infinite_tracing/newrelic-infinite_tracing
- name: Create release tags for Lambda and K8s Init Containers
run: |
RELEASE_TITLE="New Relic Ruby Agent ${GITHUB_REF}.0"
RELEASE_TAG="${GITHUB_REF}.0_ruby"
RELEASE_NOTES="Automated release for [Ruby Agent ${GITHUB_REF}](https://github.com/newrelic/newrelic-ruby-agent/releases/tag/${GITHUB_REF})"
gh auth login --with-token <<< $GH_RELEASE_TOKEN
echo "newrelic/newrelic-lambda-layers - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}"
gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-lambda-layers --notes=${RELEASE_NOTES}
echo "newrelic/newrelic-agent-init-container - Releasing ${RELEASE_TITLE} with tag ${RELEASE_TAG}"
gh release create "${RELEASE_TAG}" --title=${RELEASE_TITLE} --repo=newrelic/newrelic-agent-init-container --notes=${RELEASE_NOTES}
env:
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}