diff --git a/.github/workflows/software-upgrade-test.yml b/.github/workflows/software-upgrade-test.yml index bb46f6719..3d804b8b2 100644 --- a/.github/workflows/software-upgrade-test.yml +++ b/.github/workflows/software-upgrade-test.yml @@ -78,15 +78,43 @@ jobs: curl -L $SNAPSHOT_DOWNLOAD_URL -o $SNAPSHOT_FILE_PATH if: steps.cache-snapshot.outputs.cache-hit != 'true' - pre-software-upgrade: + retrieve-old-binary: runs-on: ubuntu-latest needs: retrieve-latest-tag outputs: - NEW_UPGRADE_ASSURE_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} - SNAPSHOT_DOWNLOAD_URL: ${{ steps.retrieve-info-json.outputs.SNAPSHOT_DOWNLOAD_URL }} + OLD_BINARY_PATH: ${{ steps.retrieve-latest-binary.outputs.OLD_BINARY_PATH }} + + steps: + - name: Set old binary path + run: | + OLD_BINARY_PATH=/tmp/elysd-$LATEST_TAG + echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV + echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_OUTPUT + + - name: Cache old binary + uses: actions/cache@v4 + id: cache-old-binary + with: + path: | + ${{ env.OLD_BINARY_PATH }} + key: ${{ runner.os }}-snapshot-${{ needs.retrieve-latest-tag.outputs.LATEST_TAG }} + + - name: Retrieve latest binary + run: | + DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/$LATEST_TAG/elysd-$LATEST_TAG-linux-amd64 + curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH + + # TODO: retrieve upgrade-assure and upload-snapshot binaries + if: steps.cache-old-binary.outputs.cache-hit != 'true' + + build-new-binary: + runs-on: ubuntu-latest + + outputs: NEW_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_BINARY_PATH }} + NEW_UPGRADE_ASSURE_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} UPLOAD_SNAPSHOT_BINARY_PATH: ${{ steps.build-new-binaries.outputs.UPLOAD_SNAPSHOT_BINARY_PATH }} steps: @@ -101,25 +129,6 @@ jobs: with: go-version: "1.21" - - name: Cache Directories - uses: actions/cache@v4 - id: cache-elys-folders - with: - path: | - ${{ env.HOME }}/.elys - ${{ env.HOME }}/.elys2 - key: ${{ runner.os }}-elys-folders-${{ env.LATEST_TAG }} - - - name: Retrieve latest binary - run: | - DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/$LATEST_TAG/elysd-$LATEST_TAG-linux-amd64 - OLD_BINARY_PATH=/tmp/elysd-$LATEST_TAG - curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH - echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV - - # TODO: retrieve upgrade-assure and upload-snapshot binaries - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - - name: Create git tag run: git tag v999.999.999 @@ -143,6 +152,48 @@ jobs: make build-upload-snapshot UPLOAD_SNAPSHOT_BINARY_PATH=./build/upload-snapshot echo "UPLOAD_SNAPSHOT_BINARY_PATH=$UPLOAD_SNAPSHOT_BINARY_PATH" >> $GITHUB_ENV + echo "UPLOAD_SNAPSHOT_BINARY_PATH=$UPLOAD_SNAPSHOT_BINARY_PATH" >> $GITHUB_OUTPUT + + - name: Save new binary as artifact + uses: actions/upload-artifact@v3 + with: + name: new-binary + path: | + ${{ env.NEW_BINARY_PATH }} + ${{ env.NEW_UPGRADE_ASSURE_BINARY_PATH}} + ${{ env.UPLOAD_SNAPSHOT_BINARY_PATH }} + + pre-software-upgrade: + runs-on: ubuntu-latest + + needs: retrieve-latest-tag + + outputs: + NEW_UPGRADE_ASSURE_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} + SNAPSHOT_DOWNLOAD_URL: ${{ steps.retrieve-info-json.outputs.SNAPSHOT_DOWNLOAD_URL }} + NEW_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_BINARY_PATH }} + UPLOAD_SNAPSHOT_BINARY_PATH: ${{ steps.build-new-binaries.outputs.UPLOAD_SNAPSHOT_BINARY_PATH }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" + + - name: Cache Directories + uses: actions/cache@v4 + id: cache-elys-folders + with: + path: | + ${{ env.HOME }}/.elys + ${{ env.HOME }}/.elys2 + key: ${{ runner.os }}-elys-folders-${{ env.LATEST_TAG }} # TODO: to remove when upgrade-assure binary is available in previous release - name: Copy upgrade assure folder