Skip to content

Check if we're using the latest Helium Light Gateway (gateway-rs) release #18060

Check if we're using the latest Helium Light Gateway (gateway-rs) release

Check if we're using the latest Helium Light Gateway (gateway-rs) release #18060

name: Check if we're using the latest Helium Light Gateway (gateway-rs) release
on:
schedule:
- cron: "00 * * * *" # Run hourly
workflow_dispatch:
jobs:
latest-version:
name: Get Latest Release
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Get latest release
id: gatewayrs
uses: pozetroninc/[email protected]
with:
owner: helium
repo: gateway-rs
token: ${{ secrets.GITHUB_TOKEN }}
# keep bumping the excludes, right now we only have alpha to track.
# later we will start tracking beta and finally release
excludes: prerelease, draft
- name: Update gateway rs release if required
run: |
# Get the latest GA release and update if necessary
LATEST_GA=${{ steps.gatewayrs.outputs.release }}
GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' )
echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV
echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV
if grep -q "$LATEST_GA" Dockerfile; then
echo "We're on the latest Helium gateway-rs release $LATEST_GA."
exit 0
else
echo "We're not on the latest Helium gateway-rs release. Updating to $LATEST_GA."
sed -i -E 's/GATEWAY_RS_RELEASE=.*/GATEWAY_RS_RELEASE='$LATEST_GA'/g' Dockerfile
UPDATED=true
echo "UPDATED=$UPDATED" >> $GITHUB_ENV
sleep 900
exit 0
fi
- name: Push updated Dockerfile if available
if: env.UPDATED == 'true'
id: push
uses: test-room-7/action-update-file@v1
with:
branch: ${{ env.GITHUB_BRANCH }}
file-path: Dockerfile
commit-msg: Update gateway-rs to latest GA ${{ env.LATEST_GA }}
github-token: ${{ secrets.MR_BUMP }}
- name: Tag Commit
if: env.UPDATED == 'true'
uses: NebraLtd/git-tag-action@master
env:
TAG: ${{ env.LATEST_GA }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ steps.push.outputs.commit-sha }}
- name: Release
if: env.UPDATED == 'true'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: "Bump gateway-rs to ${{ env.LATEST_GA }}"
commit: ${{ steps.push.outputs.commit-sha }}
tag: ${{ env.LATEST_GA }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger PR action in helium-miner-software repo
if: env.UPDATED == 'true'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.MR_BUMP }}
event-type: gatewayrs-update
repository: NebraLtd/helium-miner-software
client-payload: '{"sha": "${{ steps.push.outputs.commit-sha }}", "release": "${{ env.LATEST_GA }}", "tag": "${{ env.LATEST_GA }}"}'
- name: Report Status
if: env.UPDATED == 'true'
uses: ravsamhq/notify-slack-action@master
with:
status: ${{ job.status }}
notification_title: 'Helium gateway-rs has been updated to ${{ env.LATEST_GA }}. Please push to light testnet!'
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: 'S02GCFWL27R'
notify_when: 'success'
token: ${{ secrets.GITHUB_TOKEN }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.MINER_MONITORING_SLACK }}
- name: Report Status Dev Team
if: env.UPDATED == 'true'
uses: ravsamhq/notify-slack-action@master
with:
status: ${{ job.status }}
notification_title: 'Helium gateway-rs has been updated to ${{ env.LATEST_GA }}. Please push to testnet!'
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: 'S02GCFWL27R'
notify_when: 'success'
token: ${{ secrets.GITHUB_TOKEN }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.DEV_TEAM_SLACK }}