From e62801a1aadd3733e80e81a0d00fe5c56499f9d4 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Sun, 21 Nov 2021 22:39:18 +0000 Subject: [PATCH 1/8] feat: create production PR automatically Create production PR automatically when pushing a miner release to testnet --- .github/workflows/update-production.yml | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/update-production.yml diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml new file mode 100644 index 00000000..a5e55067 --- /dev/null +++ b/.github/workflows/update-production.yml @@ -0,0 +1,45 @@ +name: Update Miner GA (Production) +on: + pull_request: + branches: + - master + types: [closed] + +jobs: + miner-update: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: Set current date and latest GA as env variable, check PR title + run: | + # Get the latest GA release name + LATEST_GA=$(curl -s https://quay.io/v1/repositories/team-helium/miner/tags | jq -r --sort-keys '. | keys[] | select(. | endswith("GA"))' | tail -n 1 | sed 's/miner-arm64_//g' | sed 's/_GA//g') + echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV + + # Get the UTC date and time + echo "NOW::$(date -u)" >> $GITHUB_ENV + + # Check pull request title + PR_TITLE_CHECK="release(testnet): Update miner to latest GA" + if grep -q "$PR_TITLE_CHECK" <<< "${{ github.event.pull_request.title }}"; then + UPDATED=true + echo "UPDATED=$UPDATED" >> $GITHUB_ENV + exit 0 + fi + - name: Create Pull Request + if: env.UPDATED == 'true' + uses: devops-infra/action-pull-request@v0.4.2 + with: + source_branch: master + target_branch: production + title: "release(prod): Update miner to latest GA ${{ env.LATEST_GA }}" + body: | + Update miner to latest GA ${{ env.LATEST_GA }} + + Ref #${{ github.event.number }} + + Pushed to testnet at ${{ env.NOW }} + draft: false From 62a31100cfc3d6a47023899a76020fb921aa28ba Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Sun, 21 Nov 2021 22:40:09 +0000 Subject: [PATCH 2/8] Update name Add testnet to name --- .github/workflows/update-miner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-miner.yml index c3e600af..e867efeb 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-miner.yml @@ -1,4 +1,4 @@ -name: Update Miner GA +name: Update Miner GA (Testnet) on: repository_dispatch: types: [miner-update] From 85757119cb4fc5c041531a8a94366035a9ebf83c Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Mon, 22 Nov 2021 01:16:34 +0000 Subject: [PATCH 3/8] fix: add arch type in name Due to new multi architecture building in hm-miner we need to now add the arm64 tag here Relates-to: #https://github.com/NebraLtd/hm-miner/pull/56 --- .github/workflows/update-miner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-miner.yml index e867efeb..044f4cf3 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-miner.yml @@ -18,7 +18,7 @@ jobs: echo "We're not on the latest Helium GA release. Updating to $LATEST_GA with SHA $SHORT_SHA." sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" docker-compose.yml - sed -i -E "s/nebraltd\/hm-miner:.*/nebraltd\/hm-miner:$SHORT_SHA/g" docker-compose.yml + sed -i -E "s/nebraltd\/hm-miner:.*/nebraltd\/hm-miner:arm64-$SHORT_SHA/g" docker-compose.yml - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: From 1b675bcf0a2f7cff27f6edfe8a8e5de39c9cc601 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Mon, 22 Nov 2021 20:31:27 +0000 Subject: [PATCH 4/8] feat: bump miner to latest arm64-version bump miner to latest arm64-version --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 04c506c9..7babd715 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: - pktfwdr:/var/pktfwd helium-miner: - image: nebraltd/hm-miner:2b50552 + image: nebraltd/hm-miner:arm64-2a0e41b depends_on: - dbus-session - diagnostics From c1b60a3b5129f1b22ac7ea33129fcc98a3e92ee7 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Mon, 22 Nov 2021 21:52:22 +0000 Subject: [PATCH 5/8] fix environment variable fix environment variable --- .github/workflows/update-production.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index a5e55067..99373a69 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -20,7 +20,7 @@ jobs: echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV # Get the UTC date and time - echo "NOW::$(date -u)" >> $GITHUB_ENV + echo "NOW=$(date -u)" >> $GITHUB_ENV # Check pull request title PR_TITLE_CHECK="release(testnet): Update miner to latest GA" From 9d13de70eb8fb6bb35db283ac086e64e55bc3215 Mon Sep 17 00:00:00 2001 From: mr-bump Date: Tue, 23 Nov 2021 06:03:29 +0000 Subject: [PATCH 6/8] Update miner to latest GA 2021.11.22.0 --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7babd715..13e042df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - dbus-session - diagnostics environment: - - FIRMWARE_VERSION=2021.11.21.2 + - FIRMWARE_VERSION=2021.11.22.0 - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket privileged: true @@ -34,7 +34,7 @@ services: - pktfwdr:/var/pktfwd helium-miner: - image: nebraltd/hm-miner:arm64-2a0e41b + image: nebraltd/hm-miner:arm64-d760384 depends_on: - dbus-session - diagnostics @@ -59,7 +59,7 @@ services: diagnostics: image: nebraltd/hm-diag:7e26f35 environment: - - FIRMWARE_VERSION=2021.11.21.2 + - FIRMWARE_VERSION=2021.11.22.0 volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data @@ -85,7 +85,7 @@ services: - dbus:/session/dbus environment: - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2021.11.21.2 + - FIRMWARE_VERSION=2021.11.22.0 volumes: miner-storage: From 5671918f4bfb2f2ef906ae714e42591a8df39187 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 23 Nov 2021 06:14:03 +0000 Subject: [PATCH 7/8] Update update-production.yml --- .github/workflows/update-production.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index 99373a69..96697c80 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -35,6 +35,7 @@ jobs: with: source_branch: master target_branch: production + github_token: ${{ secrets.GITHUB_TOKEN }} title: "release(prod): Update miner to latest GA ${{ env.LATEST_GA }}" body: | Update miner to latest GA ${{ env.LATEST_GA }} From 0eed2c602c51daf1adae98d9bc3451aedc5395d7 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 23 Nov 2021 06:25:29 +0000 Subject: [PATCH 8/8] set fetch depth 0 Fetch the whole repo --- .github/workflows/update-production.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index 96697c80..9c8756d1 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -13,6 +13,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.ref }} + fetch-depth: 0 - name: Set current date and latest GA as env variable, check PR title run: | # Get the latest GA release name