-
-
Notifications
You must be signed in to change notification settings - Fork 17
69 lines (65 loc) · 3.1 KB
/
update-gateway-mfr-rs.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
name: Check if we're using the latest Gateway MFR (gateway-mfr-rs) release
on:
schedule:
- cron: "0 0 * * 0" # Run weekly on sunday
workflow_dispatch:
jobs:
latest-version:
name: Get Latest Release
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Get Latest Release
id: latest_version
uses: abatilo/[email protected]
with:
owner: helium
repo: gateway-mfr-rs
- name: Perform check and update
env:
GATEWAY_MFR_RS_RELEASE: ${{ steps.latest_version.outputs.latest_tag }}
run: |
GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' )
CHECK_LATEST_RELEASE="GATEWAY_MFR_RS_RELEASE: "\""${GATEWAY_MFR_RS_RELEASE}"\"""
echo "GATEWAY_MFR_RS_RELEASE=$GATEWAY_MFR_RS_RELEASE" >> $GITHUB_ENV
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
# Get the latest gateway-mfr-rs release
if grep -q "$CHECK_LATEST_RELEASE" .github/workflows/publish-to-pypi-test.yml; then
echo "We're on the latest Helium gateway-mfr-rs release $GATEWAY_MFR_RS_RELEASE."
exit 0
else
echo "We're not on the latest Helium gateway-mfr-rs release. Updating to $GATEWAY_MFR_RS_RELEASE."
sed -i -E 's/GATEWAY_MFR_RS_RELEASE: "v.*/GATEWAY_MFR_RS_RELEASE: "'$GATEWAY_MFR_RS_RELEASE'"/g' .github/workflows/publish-to-pypi-test.yml
sed -i -E 's/GATEWAY_MFR_RS_RELEASE: "v.*/GATEWAY_MFR_RS_RELEASE: "'$GATEWAY_MFR_RS_RELEASE'"/g' .github/workflows/publish-to-pypi.yml
UPDATED=true
echo "UPDATED=$UPDATED" >> $GITHUB_ENV
exit 0
fi
- name: Create Pull Request
if: env.UPDATED == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.MR_BUMP }}
commit-message: Update gateway-mfr-rs to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }}
branch: gateway-mfr-rs/${{ env.GATEWAY_MFR_RS_RELEASE }}
delete-branch: true
base: master
title: "gateway-mfr-rs: Update to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }}"
body: |
Update gateway-mfr-rs to latest release ${{ env.GATEWAY_MFR_RS_RELEASE }}
Ref https://github.com/helium/gateway-mfr-rs/releases/tag/${{ env.GATEWAY_MFR_RS_RELEASE }}
draft: false
- name: Report Status
if: env.UPDATED == 'true'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notification_title: 'Gateway-mfr-rs has been updated to ${{ env.GATEWAY_MFR_RS_RELEASE }}. Please review PR!'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>'
footer: '<{run_url}|View Run> | Linked Repo <{repo_url}|{repo}> | <{workflow_url}|View Workflow>'
mention_groups: ${{ secrets.SLACK_DEVELOPERS_GROUP }}
notify_when: 'success'
token: ${{ secrets.GITHUB_TOKEN }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.MINER_MONITORING_SLACK }}