Skip to content

Commit 485eaa7

Browse files
author
Aaron Roller
committed
fix: Notifying AMROS of releases AM-280 AM-278/cont-deploy
1 parent 3ddc937 commit 485eaa7

File tree

1 file changed

+55
-11
lines changed

1 file changed

+55
-11
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ on:
33
push:
44
branches:
55
- master
6+
env:
7+
RELEASE_DIR: release
8+
RELEASE_PROPERTIES_FILE: release/release.properties
9+
RELEASE_PAYLOAD_FILE: release/payload.json
610
jobs:
711
release:
8-
runs-on: ubuntu-18.04
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [[x64,self-hosted,linux]]
916
steps:
17+
- uses: AutoModality/action-clean@v1.1.0
1018
- name: Checkout
1119
uses: actions/checkout@v2
1220
- name: Semantic Release
@@ -15,57 +23,64 @@ jobs:
1523
env:
1624
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1725
- name: Write release result to file
18-
run: mkdir release
26+
run: mkdir ${{ env.RELEASE_DIR }}
1927
- name: Write Published
2028
uses: christian-draeger/write-properties@1.0.1
2129
with:
22-
path: 'release.properties'
30+
path: ${{ env.RELEASE_PROPERTIES_FILE }}
2331
property: 'published'
2432
value: ${{ steps.semantic.outputs.new_release_published }}
2533
- name: Write Version
2634
uses: christian-draeger/write-properties@1.0.1
2735
if: steps.semantic.outputs.new_release_published == 'true'
2836
with:
29-
path: 'release.properties'
37+
path: ${{ env.RELEASE_PROPERTIES_FILE }}
3038
property: 'version'
3139
value: ${{ steps.semantic.outputs.new_release_version }}
40+
- name: Write Release Payload
41+
run: |
42+
#retrieve package name from changelog guaranteed to be first characters ( split on space, choose first result)
43+
package_name=$(head -1 debian/changelog | awk -F' ' '{print $1}')
44+
echo "{\"package\":\"${package_name}\", \"new_release_version\": \"${{ steps.semantic.outputs.new_release_version }}\", \"new_release_major_version\": \"${{ steps.semantic.outputs.new_release_major_version }}\", \"new_release_minor_version\":\"${{ steps.semantic.outputs.new_release_minor_version }}\",\"new_release_patch_version\":\"${{ steps.semantic.outputs.new_release_patch_version }}\"}" > ${{ env.RELEASE_PAYLOAD_FILE }}
3245
- name: Share release file with other jobs
3346
uses: actions/upload-artifact@v1
3447
with:
3548
name: release
36-
path: 'release.properties'
49+
path: '${{ env.RELEASE_DIR }}'
3750
release-package:
51+
needs: release
3852
runs-on: ${{ matrix.os }}
3953
strategy:
4054
matrix:
41-
os: [ubuntu-18.04, [self-hosted,linux,arm64]]
42-
needs: release
55+
os: [[x64,self-hosted,linux], [arm64,self-hosted,linux]]
56+
fail-fast: true
4357
name: Package if released
4458
steps:
45-
- uses: AutoModality/action-clean@v1
59+
- uses: AutoModality/action-clean@v1.1.0
4660
- name: Checkout
4761
uses: actions/checkout@v2
4862
- name: Download release
4963
uses: actions/download-artifact@v1
5064
with:
5165
name: release
66+
path: ${{ env.RELEASE_DIR }}
5267
- name: Read Published
5368
id: published
5469
uses: christian-draeger/read-properties@1.0.1
5570
with:
56-
path: 'release/release.properties'
71+
path: ${{ env.RELEASE_PROPERTIES_FILE }}
5772
property: 'published'
5873
- name: Read Version if published
5974
id: version
6075
if: steps.published.outputs.value == 'true'
6176
uses: christian-draeger/read-properties@1.0.1
6277
with:
63-
path: 'release/release.properties'
78+
path: ${{ env.RELEASE_PROPERTIES_FILE }}
6479
property: 'version'
6580
- name: Package if published
6681
if: steps.published.outputs.value == 'true'
6782
id: package
68-
uses: AutoModality/action-package-debian-ros@v3-perception
83+
uses: AutoModality/action-package-debian-ros@v3.2.0
6984
with:
7085
version: ${{ steps.version.outputs.value }}
7186
release-repo-entitlement: ${{ secrets.CLOUDSMITH_READ_RELEASE_ENTITLEMENT }}
@@ -82,3 +97,32 @@ jobs:
8297
distro: 'ubuntu'
8398
release: 'bionic'
8499
file: '${{ steps.package.outputs.artifact-path }}'
100+
notify-amros:
101+
needs: release-package
102+
runs-on: ubuntu-latest
103+
name: Notify AMROS
104+
steps:
105+
- name: Download release
106+
uses: actions/download-artifact@v1
107+
with:
108+
name: release
109+
path: ${{ env.RELEASE_DIR }}
110+
- name: Read Published
111+
id: published
112+
uses: christian-draeger/read-properties@1.0.1
113+
with:
114+
path: ${{ env.RELEASE_PROPERTIES_FILE }}
115+
property: 'published'
116+
- name: Payload env
117+
run: |
118+
payload=$(cat ${{ env.RELEASE_PAYLOAD_FILE }} )
119+
echo ::set-env name=RELEASE_PAYLOAD::$payload
120+
- name: Notify AMROS of Release
121+
if: steps.published.outputs.value == 'true'
122+
uses: peter-evans/repository-dispatch@v1
123+
with:
124+
token: ${{ secrets.AMGITBOT_PAT }}
125+
repository: AutoModality/amros
126+
event-type: package-released
127+
client-payload: "${{ env.RELEASE_PAYLOAD }}"
128+

0 commit comments

Comments
 (0)