From 1a7b8b5096ed689a59fd78897a0c49d14e086d25 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Thu, 27 Jul 2023 15:40:26 +0100 Subject: [PATCH 01/30] Simplify images, upload multi-arch images, pipeline updates --- .github/workflows/config.yml | 42 ++++++++++++------- Dockerfile | 15 +++---- boyar/Dockerfile | 9 ---- boyar/docker-build.sh | 4 -- ...-version-file.sh => create-version-file.sh | 0 {boyar => healthcheck}/entrypoint.sh | 0 {boyar => healthcheck}/healthcheck | 0 {boyar => healthcheck}/healthcheck.js | 0 package.json | 4 +- 9 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 boyar/Dockerfile delete mode 100755 boyar/docker-build.sh rename boyar/create-version-file.sh => create-version-file.sh (100%) rename {boyar => healthcheck}/entrypoint.sh (100%) rename {boyar => healthcheck}/healthcheck (100%) rename {boyar => healthcheck}/healthcheck.js (100%) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index d9b1a0a..72b278c 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -3,7 +3,7 @@ name: "ethereum-writer-deployer" on: push: branches: - - '**' + - '**' release: types: [ published ] @@ -26,14 +26,21 @@ jobs: - run: docker --version - run: python --version - run: env - - name: Run npm install - run: npm install + - name: Run npm ci + run: npm ci + - run: npm run build + # Unit tests - run: npm install --no-save tap-xunit - run: mkdir -p _out/unit _out/e2e - run: npm test -- --timeout=1m - - run: npm run build + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: build + path: ./dist - build-and-release-to-staging: + release-to-staging: + needs: build-and-test runs-on: ubuntu-latest steps: - name: Check out repository @@ -46,14 +53,17 @@ jobs: node-version: 16 - name: setup-docker uses: docker-practice/actions-setup-docker@master - - run: ./boyar/create-version-file.sh - - name: Run npm install - run: npm install - - run: ./boyar/docker-build.sh - - name: release-to-docker-hub-staging - env: - DOCKER_HUB_IMAGE_PATH: orbsnetworkstaging/ethereum-writer - DOCKER_HUB_LOGIN: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} - DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} - run: ./.github/release-to-staging.sh - + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: build + path: ./dist + - name: Generate version + run: ./create-version-file.sh + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} + password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + - name: Build and push image + run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . diff --git a/Dockerfile b/Dockerfile index c555eaa..9dfa205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,12 +7,9 @@ WORKDIR /opt/orbs COPY package*.json ./ COPY .version ./version -RUN apk add --no-cache git +# Add daemontools as a requirement from the ethereum-writer Dockerfile +RUN apk add --no-cache git daemontools --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing -# see https://github.com/nodejs/docker-node/issues/282 - -# --no-cache: download package index on-the-fly, no need to cleanup afterwards -# --virtual: bundle packages, remove whole bundle at once, when done RUN apk --no-cache --virtual build-dependencies add \ python3 \ make \ @@ -20,8 +17,12 @@ RUN apk --no-cache --virtual build-dependencies add \ && npm install \ && apk del build-dependencies -RUN npm install +COPY ./healthcheck/healthcheck ./ +COPY ./healthcheck/healthcheck.js ./ +COPY ./healthcheck/entrypoint.sh /opt/orbs/service + +HEALTHCHECK CMD /opt/orbs/healthcheck COPY dist ./dist -CMD [ "npm", "start" ] +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/boyar/Dockerfile b/boyar/Dockerfile deleted file mode 100644 index d5bbc1a..0000000 --- a/boyar/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM local/ethereum-writer - -RUN apk add --no-cache daemontools --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing - -COPY ./healthcheck ./ -COPY ./healthcheck.js ./ -COPY ./entrypoint.sh /opt/orbs/service - -HEALTHCHECK CMD /opt/orbs/healthcheck diff --git a/boyar/docker-build.sh b/boyar/docker-build.sh deleted file mode 100755 index 4f194c9..0000000 --- a/boyar/docker-build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -npm run build -docker build -t orbsnetworkstaging/ethereum-writer:$(cat .version) ./boyar diff --git a/boyar/create-version-file.sh b/create-version-file.sh similarity index 100% rename from boyar/create-version-file.sh rename to create-version-file.sh diff --git a/boyar/entrypoint.sh b/healthcheck/entrypoint.sh similarity index 100% rename from boyar/entrypoint.sh rename to healthcheck/entrypoint.sh diff --git a/boyar/healthcheck b/healthcheck/healthcheck similarity index 100% rename from boyar/healthcheck rename to healthcheck/healthcheck diff --git a/boyar/healthcheck.js b/healthcheck/healthcheck.js similarity index 100% rename from boyar/healthcheck.js rename to healthcheck/healthcheck.js diff --git a/package.json b/package.json index c879c12..1fd7020 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "pretest": "npm run typecheck && npm run lint", "clean": "rimraf ./dist/", "prebuild": "npm run clean", - "build": "tsc --skipLibCheck -p ./tsconfig.prod.json && ./boyar/create-version-file.sh && docker build -t local/ethereum-writer .", + "build": "tsc --skipLibCheck -p ./tsconfig.prod.json && ./create-version-file.sh && docker build -t local/ethereum-writer .", "build:quick": "tsc --skipLibCheck -p ./tsconfig.prod.json", "test": "ava --verbose --serial", "test:quick": "echo '-- TEST --' && ava --verbose", @@ -65,4 +65,4 @@ "web3": "1.2.6", "yargs": "^15.3.1" } -} +} \ No newline at end of file From 93deede44f2f36c041ef0367838aeee6d896cce8 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 20 Sep 2023 10:03:52 +0100 Subject: [PATCH 02/30] Only run pipeline on certain events --- .github/workflows/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 72b278c..e4dc746 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -4,6 +4,9 @@ on: push: branches: - '**' + pull_request: + branches: + - 'main' release: types: [ published ] @@ -40,6 +43,7 @@ jobs: path: ./dist release-to-staging: + if: github.event_name == 'pull_request' && github.head_ref == 'main' needs: build-and-test runs-on: ubuntu-latest steps: From 721b0e0c0e983f4e486591cae9df13962bcb4cb4 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:10:17 +0100 Subject: [PATCH 03/30] WIP --- .github/workflows/config.yml | 126 ++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index e4dc746..ace4be1 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -11,63 +11,79 @@ on: types: [ published ] jobs: - build-and-test: + build: runs-on: ubuntu-latest steps: - - name: Check out repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: setup-docker - uses: docker-practice/actions-setup-docker@master - - run: node --version - - run: npm --version - - run: docker --version - - run: python --version - - run: env - - name: Run npm ci - run: npm ci - - run: npm run build - # Unit tests - - run: npm install --no-save tap-xunit - - run: mkdir -p _out/unit _out/e2e - - run: npm test -- --timeout=1m - - name: Upload build artifact - uses: actions/upload-artifact@v3 - with: - name: build - path: ./dist + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: setup-docker + uses: docker-practice/actions-setup-docker@master + - name: Print tooling versions + run: | + node --version + npm --version + docker --version + python --version + - name: Run npm ci + run: npm ci + - run: npm run build + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: build + path: ./dist - release-to-staging: - if: github.event_name == 'pull_request' && github.head_ref == 'main' - needs: build-and-test + test: + needs: build runs-on: ubuntu-latest steps: - - name: Check out repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: setup-docker - uses: docker-practice/actions-setup-docker@master - - name: Download build artifact - uses: actions/download-artifact@v3 - with: - name: build - path: ./dist - - name: Generate version - run: ./create-version-file.sh - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} - password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} - - name: Build and push image - run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + - name: Check out repository + uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: build + path: ./dist + - run: npm install --no-save tap-xunit + - run: mkdir -p _out/unit _out/e2e + - run: npm test -- --timeout=1m + + # release-to-staging: + # if: github.event_name == 'pull_request' && github.head_ref == 'main' + # needs: build-and-test + # runs-on: ubuntu-latest + # steps: + # - name: Check out repository + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + # - name: Setup node + # uses: actions/setup-node@v3 + # with: + # node-version: 16 + # - name: setup-docker + # uses: docker-practice/actions-setup-docker@master + # - name: Download build artifact + # uses: actions/download-artifact@v3 + # with: + # name: build + # path: ./dist + # - name: Generate version + # run: ./create-version-file.sh + # - name: Login to Docker Hub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} + # password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + # - name: Build and push image + # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . From 2ca84dca32c5615736eb6d51bb6d9bb3de87813b Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:33:49 +0100 Subject: [PATCH 04/30] WIP --- .github/workflows/config.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index ace4be1..2f40f78 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -22,8 +22,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - - name: setup-docker - uses: docker-practice/actions-setup-docker@master - name: Print tooling versions run: | node --version @@ -58,6 +56,25 @@ jobs: - run: mkdir -p _out/unit _out/e2e - run: npm test -- --timeout=1m + + version-bump: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: rickstaa/action-get-semver@v1 + id: get_semver + with: + bump_level: "minor" + - name: Print current and next version + run: | + echo "Current version: ${{ steps.get_semver.outputs.current_version }}" + echo "Next version: ${{ steps.get_semver.outputs.next_version }}" + # release-to-staging: # if: github.event_name == 'pull_request' && github.head_ref == 'main' # needs: build-and-test From 8fa321a6fe1c835113601f71a23ac3eea8310eb5 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:43:16 +0100 Subject: [PATCH 05/30] WIP --- .github/workflows/config.yml | 138 ++++++++++++++++++++++------------- 1 file changed, 89 insertions(+), 49 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 2f40f78..53a8c1d 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -11,70 +11,110 @@ on: types: [ published ] jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Print tooling versions - run: | - node --version - npm --version - docker --version - python --version - - name: Run npm ci - run: npm ci - - run: npm run build - - name: Upload build artifact - uses: actions/upload-artifact@v3 - with: - name: build - path: ./dist - - test: - needs: build - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Download build artifact - uses: actions/download-artifact@v3 - with: - name: build - path: ./dist - - run: npm install --no-save tap-xunit - - run: mkdir -p _out/unit _out/e2e - - run: npm test -- --timeout=1m + # build: + # runs-on: ubuntu-latest + # steps: + # - name: Check out repository + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + # - name: Setup node + # uses: actions/setup-node@v3 + # with: + # node-version: 16 + # - name: Print tooling versions + # run: | + # node --version + # npm --version + # docker --version + # python --version + # - name: Run npm ci + # run: npm ci + # - run: npm run build + # - name: Upload build artifact + # uses: actions/upload-artifact@v3 + # with: + # name: build + # path: ./dist + # test: + # needs: build + # runs-on: ubuntu-latest + # steps: + # - name: Check out repository + # uses: actions/checkout@v3 + # - name: Setup node + # uses: actions/setup-node@v3 + # with: + # node-version: 16 + # - name: Download build artifact + # uses: actions/download-artifact@v3 + # with: + # name: build + # path: ./dist + # - run: npm install --no-save tap-xunit + # - run: mkdir -p _out/unit _out/e2e + # - run: npm test -- --timeout=1m - version-bump: + release-to-staging: + if: github.event_name == 'pull_request' && github.head_ref == 'master' runs-on: ubuntu-latest - steps: - - name: Checkout Code + - name: Check out repository uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Extract PR title + id: extract_title + run: | + TITLE="${{ github.event.pull_request.title }}" + echo "::set-output name=pr_title::$TITLE" + + - name: Determine Version Increment + id: version_increment + run: | + TITLE="${{ steps.extract_title.outputs.pr_title }}" + + if [[ $TITLE == Patch* ]]; then + echo "::set-output name=increment::patch" + elif [[ $TITLE == Minor* ]]; then + echo "::set-output name=increment::minor" + elif [[ $TITLE == Major* ]]; then + echo "::set-output name=increment::major" + else + echo "Invalid PR title. Exiting." + exit 1 + fi + - uses: rickstaa/action-get-semver@v1 id: get_semver with: - bump_level: "minor" + bump_level: "${{ steps.version_increment.outputs.increment }}" + - name: Print current and next version run: | - echo "Current version: ${{ steps.get_semver.outputs.current_version }}" + echo "Current version: ${{ steps.get_semver.outputs.current_version }}" echo "Next version: ${{ steps.get_semver.outputs.next_version }}" + # - name: setup-docker + # uses: docker-practice/actions-setup-docker@master + # - name: Download build artifact + # uses: actions/download-artifact@v3 + # with: + # name: build + # path: ./dist + # - name: Generate version + # run: ./create-version-file.sh + # - name: Login to Docker Hub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} + # password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + # - name: Build and push image + # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + + # release-to-staging: # if: github.event_name == 'pull_request' && github.head_ref == 'main' # needs: build-and-test From b5946a057b3532a54ba5ebcd758010fc159b2f8a Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:44:39 +0100 Subject: [PATCH 06/30] WIP --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 53a8c1d..d169c22 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -57,7 +57,7 @@ jobs: # - run: npm test -- --timeout=1m release-to-staging: - if: github.event_name == 'pull_request' && github.head_ref == 'master' + if: github.event_name == 'pull_request' && github.base_ref == 'master' runs-on: ubuntu-latest steps: - name: Check out repository From 62f20f34b8dea0640cba917b288741434325ec8d Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:45:15 +0100 Subject: [PATCH 07/30] WIP --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index d169c22..6eaf983 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -57,7 +57,7 @@ jobs: # - run: npm test -- --timeout=1m release-to-staging: - if: github.event_name == 'pull_request' && github.base_ref == 'master' + # if: github.event_name == 'pull_request' && github.base_ref == 'master' runs-on: ubuntu-latest steps: - name: Check out repository From 8d7267c3919d13861fda2e70bbee47b7a8b4e806 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:50:42 +0100 Subject: [PATCH 08/30] WIP --- .github/workflows/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 6eaf983..7073c04 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -60,7 +60,7 @@ jobs: # if: github.event_name == 'pull_request' && github.base_ref == 'master' runs-on: ubuntu-latest steps: - - name: Check out repository + - name: Checkout Code uses: actions/checkout@v3 with: fetch-depth: 0 @@ -69,12 +69,13 @@ jobs: id: extract_title run: | TITLE="${{ github.event.pull_request.title }}" - echo "::set-output name=pr_title::$TITLE" + echo "PR title: $TITLE" + echo "pr_title=$TITLE" >> $GITHUB_ENV - name: Determine Version Increment id: version_increment run: | - TITLE="${{ steps.extract_title.outputs.pr_title }}" + TITLE="${{ env.pr_title }}" if [[ $TITLE == Patch* ]]; then echo "::set-output name=increment::patch" From 68288aca86135c7b9aab8a47379d5e956a3804ee Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:54:13 +0100 Subject: [PATCH 09/30] WIP --- .github/workflows/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 7073c04..c3cc3cc 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -5,8 +5,10 @@ on: branches: - '**' pull_request: - branches: - - 'main' + types: [opened, synchronize] + branches: + - 'master' + release: types: [ published ] From e8ec0dad14ec897d9c2daa9130cadb49773a23a7 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:57:35 +0100 Subject: [PATCH 10/30] WIP --- .github/workflows/config.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index c3cc3cc..f6294ce 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -6,9 +6,6 @@ on: - '**' pull_request: types: [opened, synchronize] - branches: - - 'master' - release: types: [ published ] @@ -62,6 +59,8 @@ jobs: # if: github.event_name == 'pull_request' && github.base_ref == 'master' runs-on: ubuntu-latest steps: + - name: Debug PR event + run: echo "${{ toJson(github.event.pull_request) }}" - name: Checkout Code uses: actions/checkout@v3 with: From 2404f4828eca6215ba4bcc40e0f14e900e193bce Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 08:58:41 +0100 Subject: [PATCH 11/30] WIP --- .github/workflows/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index f6294ce..cbec5f3 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -59,8 +59,6 @@ jobs: # if: github.event_name == 'pull_request' && github.base_ref == 'master' runs-on: ubuntu-latest steps: - - name: Debug PR event - run: echo "${{ toJson(github.event.pull_request) }}" - name: Checkout Code uses: actions/checkout@v3 with: From 40c02192189fbe65cce91406c4f9a94482c7a88b Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:03:52 +0100 Subject: [PATCH 12/30] WIP --- .github/workflows/config.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index cbec5f3..abe2c0c 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -77,20 +77,21 @@ jobs: TITLE="${{ env.pr_title }}" if [[ $TITLE == Patch* ]]; then - echo "::set-output name=increment::patch" + increment="patch" elif [[ $TITLE == Minor* ]]; then - echo "::set-output name=increment::minor" + increment="minor" elif [[ $TITLE == Major* ]]; then - echo "::set-output name=increment::major" + increment="major" else echo "Invalid PR title. Exiting." exit 1 fi + echo "increment=$increment" >> $GITHUB_ENV - uses: rickstaa/action-get-semver@v1 id: get_semver with: - bump_level: "${{ steps.version_increment.outputs.increment }}" + bump_level: "${{ env.increment }}" - name: Print current and next version run: | From b511cfba9ee2bf8a706e3b3228d9ca05c33dba9a Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:06:24 +0100 Subject: [PATCH 13/30] WIP --- .github/workflows/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index abe2c0c..338a436 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -74,8 +74,8 @@ jobs: - name: Determine Version Increment id: version_increment run: | - TITLE="${{ env.pr_title }}" - + TITLE="${{ env.pr_title,, }}" # Convert PR title to lowercase + if [[ $TITLE == Patch* ]]; then increment="patch" elif [[ $TITLE == Minor* ]]; then From 50756a84ad3a8508f69ee621c09c4c1e9a7df529 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:07:34 +0100 Subject: [PATCH 14/30] WIP --- .github/workflows/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 338a436..95bdb86 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -74,7 +74,7 @@ jobs: - name: Determine Version Increment id: version_increment run: | - TITLE="${{ env.pr_title,, }}" # Convert PR title to lowercase + TITLE=$(echo "${{ env.pr_title }}" | awk '{print tolower($0)}') if [[ $TITLE == Patch* ]]; then increment="patch" From dcf199bb3dd45d034c5bf308837f0f4c40a78129 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:10:53 +0100 Subject: [PATCH 15/30] WIP --- .github/workflows/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 95bdb86..a89ba87 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -74,7 +74,8 @@ jobs: - name: Determine Version Increment id: version_increment run: | - TITLE=$(echo "${{ env.pr_title }}" | awk '{print tolower($0)}') + TITLE=$(echo "${{ env.pr_title }}" | awk '{print tolower($0)}') + echo "Lowercased PR title: $TITLE" if [[ $TITLE == Patch* ]]; then increment="patch" From 146f1f41a34d3034733263961f87ff94c9407d02 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:12:11 +0100 Subject: [PATCH 16/30] WIP --- .github/workflows/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index a89ba87..21e40ed 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -77,11 +77,11 @@ jobs: TITLE=$(echo "${{ env.pr_title }}" | awk '{print tolower($0)}') echo "Lowercased PR title: $TITLE" - if [[ $TITLE == Patch* ]]; then + if [[ $TITLE == patch* ]]; then increment="patch" - elif [[ $TITLE == Minor* ]]; then + elif [[ $TITLE == minor* ]]; then increment="minor" - elif [[ $TITLE == Major* ]]; then + elif [[ $TITLE == major* ]]; then increment="major" else echo "Invalid PR title. Exiting." From 0679c8b879886c67e2b68dfdcb0678b80471a791 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:21:25 +0100 Subject: [PATCH 17/30] Image version --- .github/workflows/config.yml | 44 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 21e40ed..e0ad098 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -94,27 +94,31 @@ jobs: with: bump_level: "${{ env.increment }}" - - name: Print current and next version - run: | - echo "Current version: ${{ steps.get_semver.outputs.current_version }}" - echo "Next version: ${{ steps.get_semver.outputs.next_version }}" + # - name: Print current and next version + # run: | + # echo "Current version: ${{ steps.get_semver.outputs.current_version }}" + # echo "Next version: ${{ steps.get_semver.outputs.next_version }}" - # - name: setup-docker - # uses: docker-practice/actions-setup-docker@master - # - name: Download build artifact - # uses: actions/download-artifact@v3 - # with: - # name: build - # path: ./dist - # - name: Generate version - # run: ./create-version-file.sh - # - name: Login to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} - # password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} - # - name: Build and push image - # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + - name: Generate image version + run: | + COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7) + IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH" + echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV + - name: setup-docker + uses: docker-practice/actions-setup-docker@master + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: build + path: ./dist + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} + password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + - name: Build and push image + # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ env.image_version }} --push . # release-to-staging: From af1373cd9eeeae60cf8d5b7e0a9091d4eb8e1221 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:23:38 +0100 Subject: [PATCH 18/30] Image version --- .github/workflows/config.yml | 51 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index e0ad098..dfa0144 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -10,31 +10,31 @@ on: types: [ published ] jobs: - # build: - # runs-on: ubuntu-latest - # steps: - # - name: Check out repository - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - name: Setup node - # uses: actions/setup-node@v3 - # with: - # node-version: 16 - # - name: Print tooling versions - # run: | - # node --version - # npm --version - # docker --version - # python --version - # - name: Run npm ci - # run: npm ci - # - run: npm run build - # - name: Upload build artifact - # uses: actions/upload-artifact@v3 - # with: - # name: build - # path: ./dist + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Print tooling versions + run: | + node --version + npm --version + docker --version + python --version + - name: Run npm ci + run: npm ci + - run: npm run build + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: build + path: ./dist # test: # needs: build @@ -57,6 +57,7 @@ jobs: release-to-staging: # if: github.event_name == 'pull_request' && github.base_ref == 'master' + needs: build runs-on: ubuntu-latest steps: - name: Checkout Code From 058b1a25e5374ac4c68db99a3308275c0e5afe9f Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 09:29:53 +0100 Subject: [PATCH 19/30] Image version --- .github/workflows/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index dfa0144..fda1367 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -105,6 +105,7 @@ jobs: COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7) IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH" echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV + echo $IMAGE_VERSION > .version - name: setup-docker uses: docker-practice/actions-setup-docker@master - name: Download build artifact From e8c44f21ceb7d8ab541a555632997a0c8d0869da Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:00:05 +0100 Subject: [PATCH 20/30] Image version --- .github/workflows/config.yml | 60 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index fda1367..6d8b2fe 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -5,7 +5,11 @@ on: branches: - '**' pull_request: - types: [opened, synchronize] + types: + - opened + - synchronize + - reopened + - edited release: types: [ published ] @@ -36,28 +40,30 @@ jobs: name: build path: ./dist - # test: - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Check out repository - # uses: actions/checkout@v3 - # - name: Setup node - # uses: actions/setup-node@v3 - # with: - # node-version: 16 - # - name: Download build artifact - # uses: actions/download-artifact@v3 - # with: - # name: build - # path: ./dist - # - run: npm install --no-save tap-xunit - # - run: mkdir -p _out/unit _out/e2e - # - run: npm test -- --timeout=1m + test: + needs: build + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: build + path: ./dist + - run: npm install --no-save tap-xunit + - run: mkdir -p _out/unit _out/e2e + - run: npm test -- --timeout=1m release-to-staging: - # if: github.event_name == 'pull_request' && github.base_ref == 'master' - needs: build + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' + needs: + - build + - test runs-on: ubuntu-latest steps: - name: Checkout Code @@ -95,29 +101,29 @@ jobs: with: bump_level: "${{ env.increment }}" - # - name: Print current and next version - # run: | - # echo "Current version: ${{ steps.get_semver.outputs.current_version }}" - # echo "Next version: ${{ steps.get_semver.outputs.next_version }}" - - name: Generate image version run: | COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7) IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH" + echo "Generated image version: $IMAGE_VERSION" echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV echo $IMAGE_VERSION > .version - - name: setup-docker + + - name: Setup Docker uses: docker-practice/actions-setup-docker@master + - name: Download build artifact uses: actions/download-artifact@v3 with: name: build path: ./dist + - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + - name: Build and push image # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ env.image_version }} --push . From 513ce16a027e2b09f2d76a9c06984c5019cf1fb6 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:38:54 +0100 Subject: [PATCH 21/30] Image version --- .github/workflows/config.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 6d8b2fe..43029f1 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -1,9 +1,6 @@ name: "ethereum-writer-deployer" on: - push: - branches: - - '**' pull_request: types: - opened @@ -59,18 +56,12 @@ jobs: - run: mkdir -p _out/unit _out/e2e - run: npm test -- --timeout=1m - release-to-staging: - if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' + determine-version: needs: - build - test runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Extract PR title id: extract_title run: | @@ -105,10 +96,25 @@ jobs: run: | COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7) IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH" - echo "Generated image version: $IMAGE_VERSION" - echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV - echo $IMAGE_VERSION > .version + if [[ ${{ github.event_name }} == 'release' ]]; then + echo "Release event detected. Using version from tag." + IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}" + fi + + # echo "Generated image version: $IMAGE_VERSION" + # echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV + # echo $IMAGE_VERSION > .version + echo "::set-output name=image_version::$IMAGE_VERSION" + + + release-to-staging: + needs: + - build + - test + - determine-version + runs-on: ubuntu-latest + steps: - name: Setup Docker uses: docker-practice/actions-setup-docker@master @@ -126,7 +132,7 @@ jobs: - name: Build and push image # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . - run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ env.image_version }} --push . + run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ needs.determine-version.output.image_version }} --push . # release-to-staging: From aa7ae14f0a601dec10c583822bb6309e68609eeb Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:44:33 +0100 Subject: [PATCH 22/30] Image version --- .github/workflows/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 43029f1..fd53350 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -57,11 +57,12 @@ jobs: - run: npm test -- --timeout=1m determine-version: - needs: - - build - - test runs-on: ubuntu-latest steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Extract PR title id: extract_title run: | From 8d2e4e3dbea9b689b248b18c67ac1497a0ca74be Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:49:46 +0100 Subject: [PATCH 23/30] Image version --- .github/workflows/config.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index fd53350..c14ca9d 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -103,10 +103,14 @@ jobs: IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}" fi - # echo "Generated image version: $IMAGE_VERSION" - # echo "image_version=$IMAGE_VERSION" >> $GITHUB_ENV - # echo $IMAGE_VERSION > .version - echo "::set-output name=image_version::$IMAGE_VERSION" + echo "Generated image version: $IMAGE_VERSION" + echo $IMAGE_VERSION > .version + + - name: Upload .version as artifact + uses: actions/upload-artifact@v3 + with: + name: version + path: .version release-to-staging: @@ -125,6 +129,12 @@ jobs: name: build path: ./dist + - name: Download version artifact + uses: actions/download-artifact@v3 + with: + name: version + path: ./ + - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -133,7 +143,7 @@ jobs: - name: Build and push image # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . - run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:${{ needs.determine-version.output.image_version }} --push . + run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . # release-to-staging: From 686949ed6238e411b2dc8dd8ea17f4c543c2e9a5 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:58:15 +0100 Subject: [PATCH 24/30] Image version --- .github/workflows/config.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index c14ca9d..00ace37 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -2,6 +2,8 @@ name: "ethereum-writer-deployer" on: pull_request: + branches: + - master types: - opened - synchronize @@ -146,6 +148,42 @@ jobs: run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + release-to-staging-immediate: + if: github.event_name == 'pull_request' && github.event.label.name == 'immediate' + needs: + - build + - test + - determine-version + runs-on: ubuntu-latest + steps: + - name: Setup Docker + uses: docker-practice/actions-setup-docker@master + + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: build + path: ./dist + + - name: Download version artifact + uses: actions/download-artifact@v3 + with: + name: version + path: ./ + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} + password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} + + - name: Build and push image + + run: | + IMMEDIATE_VERSION=$(awk -F'-' '{print $1"-immediate"}' .version) + docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$IMMEDIATE_VERSION --push . + + # release-to-staging: # if: github.event_name == 'pull_request' && github.head_ref == 'main' # needs: build-and-test From 1cf97e74e98108e72467748905c9108a5a13ee57 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 10:59:45 +0100 Subject: [PATCH 25/30] Image version --- .github/workflows/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 00ace37..c881f04 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -122,6 +122,8 @@ jobs: - determine-version runs-on: ubuntu-latest steps: + - name: Check out repository + uses: actions/checkout@v3 - name: Setup Docker uses: docker-practice/actions-setup-docker@master @@ -156,6 +158,8 @@ jobs: - determine-version runs-on: ubuntu-latest steps: + - name: Check out repository + uses: actions/checkout@v3 - name: Setup Docker uses: docker-practice/actions-setup-docker@master From 472e66b19d90c1a29490b434987e6f8c4ad9c10d Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Wed, 27 Sep 2023 11:07:52 +0100 Subject: [PATCH 26/30] Image version --- .github/workflows/config.yml | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index c881f04..282d8e5 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -9,6 +9,7 @@ on: - synchronize - reopened - edited + - labeled release: types: [ published ] @@ -186,34 +187,3 @@ jobs: run: | IMMEDIATE_VERSION=$(awk -F'-' '{print $1"-immediate"}' .version) docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$IMMEDIATE_VERSION --push . - - - # release-to-staging: - # if: github.event_name == 'pull_request' && github.head_ref == 'main' - # needs: build-and-test - # runs-on: ubuntu-latest - # steps: - # - name: Check out repository - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - name: Setup node - # uses: actions/setup-node@v3 - # with: - # node-version: 16 - # - name: setup-docker - # uses: docker-practice/actions-setup-docker@master - # - name: Download build artifact - # uses: actions/download-artifact@v3 - # with: - # name: build - # path: ./dist - # - name: Generate version - # run: ./create-version-file.sh - # - name: Login to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_HUB_STAGING_LOGIN }} - # password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} - # - name: Build and push image - # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . From 6aabb4c5c251610cb3694137a7b222fe3739967b Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Fri, 29 Sep 2023 08:57:18 +0100 Subject: [PATCH 27/30] Use composite action --- .github/workflows/config.yml | 56 +++++++----------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 282d8e5..cd7bbcd 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -59,56 +59,20 @@ jobs: - run: mkdir -p _out/unit _out/e2e - run: npm test -- --timeout=1m - determine-version: + create-version-file: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Extract PR title - id: extract_title - run: | - TITLE="${{ github.event.pull_request.title }}" - echo "PR title: $TITLE" - echo "pr_title=$TITLE" >> $GITHUB_ENV - - - name: Determine Version Increment - id: version_increment - run: | - TITLE=$(echo "${{ env.pr_title }}" | awk '{print tolower($0)}') - echo "Lowercased PR title: $TITLE" - - if [[ $TITLE == patch* ]]; then - increment="patch" - elif [[ $TITLE == minor* ]]; then - increment="minor" - elif [[ $TITLE == major* ]]; then - increment="major" - else - echo "Invalid PR title. Exiting." - exit 1 - fi - echo "increment=$increment" >> $GITHUB_ENV - - - uses: rickstaa/action-get-semver@v1 - id: get_semver + - id: getVersion + uses: Luke-Rogerson/pr-bump-version@v1 with: - bump_level: "${{ env.increment }}" - - - name: Generate image version - run: | - COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7) - IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}-$COMMIT_HASH" - - if [[ ${{ github.event_name }} == 'release' ]]; then - echo "Release event detected. Using version from tag." - IMAGE_VERSION="${{ steps.get_semver.outputs.next_version }}" - fi - - echo "Generated image version: $IMAGE_VERSION" - echo $IMAGE_VERSION > .version - + github-token: ${{ secrets.GITHUB_TOKEN }} + - run: | + echo "Version is ${{ steps.getVersion.outputs.version }}" + echo ${{ steps.getVersion.outputs.version }} > .version - name: Upload .version as artifact uses: actions/upload-artifact@v3 with: @@ -147,8 +111,9 @@ jobs: password: ${{ secrets.DOCKER_HUB_STAGING_PASSWORD }} - name: Build and push image - # run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . - run: docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . + run: | + echo "Tagging image with $(cat .version)" + docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$(cat .version) --push . release-to-staging-immediate: @@ -186,4 +151,5 @@ jobs: run: | IMMEDIATE_VERSION=$(awk -F'-' '{print $1"-immediate"}' .version) + echo "Tagging image with $IMMEDIATE_VERSION" docker buildx build --platform linux/amd64,linux/arm64 -t orbsnetworkstaging/ethereum-writer:$IMMEDIATE_VERSION --push . From 36ac81019587f9371f7bf6c48e5f649a2b6a6bda Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Fri, 29 Sep 2023 08:58:19 +0100 Subject: [PATCH 28/30] Use composite action --- .github/workflows/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index cd7bbcd..a319137 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -84,7 +84,7 @@ jobs: needs: - build - test - - determine-version + - create-version-file runs-on: ubuntu-latest steps: - name: Check out repository @@ -121,7 +121,7 @@ jobs: needs: - build - test - - determine-version + - create-version-file runs-on: ubuntu-latest steps: - name: Check out repository From 89da526ba315c6241397f14075426299715b237c Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Fri, 29 Sep 2023 09:11:35 +0100 Subject: [PATCH 29/30] WIP --- .github/workflows/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index a319137..5d2bb9b 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -68,10 +68,8 @@ jobs: fetch-depth: 0 - id: getVersion uses: Luke-Rogerson/pr-bump-version@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Version is ${{ steps.getVersion.outputs.version }}" + echo "Outputted version is ${{ steps.getVersion.outputs.version }}" echo ${{ steps.getVersion.outputs.version }} > .version - name: Upload .version as artifact uses: actions/upload-artifact@v3 From 77c94f1e9cb3ef6cce35ecebe250b2b7c73379e8 Mon Sep 17 00:00:00 2001 From: Luke Rogerson Date: Fri, 29 Sep 2023 09:29:17 +0100 Subject: [PATCH 30/30] Use composite action --- .github/workflows/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 5d2bb9b..edbdcd9 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -66,12 +66,14 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 - - id: getVersion + - name: Determine next version + id: getVersion uses: Luke-Rogerson/pr-bump-version@v1 - - run: | + - name: Write version to file + run: | echo "Outputted version is ${{ steps.getVersion.outputs.version }}" echo ${{ steps.getVersion.outputs.version }} > .version - - name: Upload .version as artifact + - name: Upload .version file as artifact uses: actions/upload-artifact@v3 with: name: version