From c0ae8146821bef527b3458de9d59c92c31e17408 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 14:02:59 -0700 Subject: [PATCH 01/19] first draft --- .../actions/check-for-new-ipfs-tag/Dockerfile | 3 +++ .../actions/check-for-new-ipfs-tag/action.yml | 9 +++++++ .../check-for-new-ipfs-tag/entrypoint.sh | 6 +++++ .github/workflows/update-on-new-ipfs-tag.yml | 24 +++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 .github/actions/check-for-new-ipfs-tag/Dockerfile create mode 100644 .github/actions/check-for-new-ipfs-tag/action.yml create mode 100755 .github/actions/check-for-new-ipfs-tag/entrypoint.sh create mode 100644 .github/workflows/update-on-new-ipfs-tag.yml diff --git a/.github/actions/check-for-new-ipfs-tag/Dockerfile b/.github/actions/check-for-new-ipfs-tag/Dockerfile new file mode 100644 index 0000000..0d119a8 --- /dev/null +++ b/.github/actions/check-for-new-ipfs-tag/Dockerfile @@ -0,0 +1,3 @@ +FROM xx +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/check-for-new-ipfs-tag/action.yml b/.github/actions/check-for-new-ipfs-tag/action.yml new file mode 100644 index 0000000..f2c990c --- /dev/null +++ b/.github/actions/check-for-new-ipfs-tag/action.yml @@ -0,0 +1,9 @@ +name: 'Check for a new go-ipfs tag' +outputs: + new_tag_available: + description: "Whether a new go-ipfs tag is available since the tag in the go.mod file of this repo" + tag_name: + description: "go-ipfs tag name, if a new tag is available" +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh new file mode 100755 index 0000000..bfccf85 --- /dev/null +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -eu + +# XXX: extract go-ipfs release from go.mod in this repo + +# XXX: extract release XXX diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml new file mode 100644 index 0000000..03e1cfe --- /dev/null +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -0,0 +1,24 @@ +name: Update repo on new ipfs-tag release +on: + workflow_dispatch: + schedule: + - cron: '30 5,17 * * *' # run every day at 5:30am and 5:30pm UTC + +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout http-api-docs + uses: actions/checkout@v2 + with: + path: ./http-api-docs + - name: Checkout go-ipfs + uses: actions/checkout@v2 + with: + repository: ipfs/go-ipfs + path: ./go-ipfs + - name: List directories + run: | + ls -l + ls -l ./http-api-docs + ls -l ./go-ipfs From 9e4d45417c467815fe33358e663c75cb851d8a0e Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 14:56:55 -0700 Subject: [PATCH 02/19] add push trigger --- .github/workflows/update-on-new-ipfs-tag.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 03e1cfe..0d8b8e4 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -1,8 +1,9 @@ name: Update repo on new ipfs-tag release on: - workflow_dispatch: - schedule: - - cron: '30 5,17 * * *' # run every day at 5:30am and 5:30pm UTC + push: + # workflow_dispatch: + # schedule: + # - cron: '30 5,17 * * *' # run every day at 5:30am and 5:30pm UTC jobs: update: From b7a02c3d11346a59957d4fefd08a821b75ebb8bf Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 15:15:04 -0700 Subject: [PATCH 03/19] add beginnings of update action --- .github/actions/check-for-new-ipfs-tag/Dockerfile | 2 +- .github/actions/check-for-new-ipfs-tag/entrypoint.sh | 5 ++++- .github/workflows/update-on-new-ipfs-tag.yml | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-for-new-ipfs-tag/Dockerfile b/.github/actions/check-for-new-ipfs-tag/Dockerfile index 0d119a8..0b97507 100644 --- a/.github/actions/check-for-new-ipfs-tag/Dockerfile +++ b/.github/actions/check-for-new-ipfs-tag/Dockerfile @@ -1,3 +1,3 @@ -FROM xx +FROM alpine:3.10 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh index bfccf85..99a93ca 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash set -eu -# XXX: extract go-ipfs release from go.mod in this repo +# extract go-ipfs release tag used in http-api-docs from go.mod in this repo +CURRENT_IPFS_TAG = $(grep 'github.com/ipfs/go-ipfs ' ./http-api-docs/go.mod | awk '{print $2}') + +echo "The currently used IPFS tag is ${CURRENT_IPFS_TAG}" # XXX: extract release XXX diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 0d8b8e4..fa7aad3 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -18,8 +18,11 @@ jobs: with: repository: ipfs/go-ipfs path: ./go-ipfs + fetch-depth: 0 - name: List directories run: | ls -l ls -l ./http-api-docs ls -l ./go-ipfs + - name: Update http-api-docs, if necessary + uses: ./.github/actions/check-for-new-ipfs-tag From e708a4ebe29dfec5e843aad829b69f2c9fef91ba Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 15:18:09 -0700 Subject: [PATCH 04/19] fix --- .github/workflows/update-on-new-ipfs-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index fa7aad3..35b3728 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -25,4 +25,4 @@ jobs: ls -l ./http-api-docs ls -l ./go-ipfs - name: Update http-api-docs, if necessary - uses: ./.github/actions/check-for-new-ipfs-tag + uses: ./http-api-docs/.github/actions/check-for-new-ipfs-tag From 537ccb74c6c45f3d861c1d30ac557301db4ca855 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 15:19:17 -0700 Subject: [PATCH 05/19] fix --- .github/actions/check-for-new-ipfs-tag/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh index 99a93ca..3baacf2 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -eu # extract go-ipfs release tag used in http-api-docs from go.mod in this repo From 4c0cce48026ba14fb5922dd91c43a4212b49cf7f Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Tue, 7 Sep 2021 15:21:59 -0700 Subject: [PATCH 06/19] fixix --- .github/actions/check-for-new-ipfs-tag/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh index 3baacf2..2724958 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -2,7 +2,7 @@ set -eu # extract go-ipfs release tag used in http-api-docs from go.mod in this repo -CURRENT_IPFS_TAG = $(grep 'github.com/ipfs/go-ipfs ' ./http-api-docs/go.mod | awk '{print $2}') +CURRENT_IPFS_TAG=`grep 'github.com/ipfs/go-ipfs ' ./http-api-docs/go.mod | awk '{print $2}'` echo "The currently used IPFS tag is ${CURRENT_IPFS_TAG}" From 4baa7b7f2b721d20fc899f75207f580e7cd2defa Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 06:43:06 -0700 Subject: [PATCH 07/19] add new go-ipfs tag in go.mod automatically --- .../actions/check-for-new-ipfs-tag/Dockerfile | 2 +- .../check-for-new-ipfs-tag/entrypoint.sh | 22 +++++++++++++++++-- .github/workflows/update-on-new-ipfs-tag.yml | 10 ++++----- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/actions/check-for-new-ipfs-tag/Dockerfile b/.github/actions/check-for-new-ipfs-tag/Dockerfile index 0b97507..34e65f5 100644 --- a/.github/actions/check-for-new-ipfs-tag/Dockerfile +++ b/.github/actions/check-for-new-ipfs-tag/Dockerfile @@ -1,3 +1,3 @@ -FROM alpine:3.10 +FROM golang:1.17 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh index 2724958..fe50c73 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -3,7 +3,25 @@ set -eu # extract go-ipfs release tag used in http-api-docs from go.mod in this repo CURRENT_IPFS_TAG=`grep 'github.com/ipfs/go-ipfs ' ./http-api-docs/go.mod | awk '{print $2}'` - echo "The currently used IPFS tag is ${CURRENT_IPFS_TAG}" -# XXX: extract release XXX +# extract IPFS release +cd go-ipfs +LATEST_IPFS_TAG=`git describe --tags --abbrev=0` +echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" +cd ../ + +# make the upgrade, if newer go-ipfs tags exist +if [[ "$CURRENT_IPFS_TAG" == "$LATEST_IPFS_TAG" ]]; then + echo "http-api-docs already uses the latest go-ipfs tag." +else + cd http-api-docs + git checkout -b update-ipfs-to-$LATEST_IPFS_TAG + sed "s/^\s*github.com\/ipfs\/go-ipfs\s\+$CURRENT_IPFS_TAG\s*$/ github.com\/ipfs\/go-ipfs $LATEST_IPFS_TAG/" go.mod > go.mod2 + mv go.mod2 go.mod + go mod tidy + make + git add -u + git commit -m "Bumped go-ipfs dependence to tag $LATEST_IPFS_TAG." + cd .. +fi diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 35b3728..0157bff 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -19,10 +19,10 @@ jobs: repository: ipfs/go-ipfs path: ./go-ipfs fetch-depth: 0 - - name: List directories - run: | - ls -l - ls -l ./http-api-docs - ls -l ./go-ipfs + # - name: List directories + # run: | + # ls -l + # ls -l ./http-api-docs + # ls -l ./go-ipfs - name: Update http-api-docs, if necessary uses: ./http-api-docs/.github/actions/check-for-new-ipfs-tag From ce9a6a4244560b990e66d19b88ab60fbaef7d623 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:11:48 -0700 Subject: [PATCH 08/19] add latest-ipfs-tag action --- .../actions/check-for-new-ipfs-tag/action.yml | 5 ----- .../check-for-new-ipfs-tag/entrypoint.sh | 2 +- .github/actions/latest-ipfs-tag/Dockerfile | 3 +++ .github/actions/latest-ipfs-tag/action.yml | 7 +++++++ .github/actions/latest-ipfs-tag/entrypoint.sh | 10 ++++++++++ .github/workflows/update-on-new-ipfs-tag.yml | 17 ++--------------- 6 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 .github/actions/latest-ipfs-tag/Dockerfile create mode 100644 .github/actions/latest-ipfs-tag/action.yml create mode 100755 .github/actions/latest-ipfs-tag/entrypoint.sh diff --git a/.github/actions/check-for-new-ipfs-tag/action.yml b/.github/actions/check-for-new-ipfs-tag/action.yml index f2c990c..878d1ba 100644 --- a/.github/actions/check-for-new-ipfs-tag/action.yml +++ b/.github/actions/check-for-new-ipfs-tag/action.yml @@ -1,9 +1,4 @@ name: 'Check for a new go-ipfs tag' -outputs: - new_tag_available: - description: "Whether a new go-ipfs tag is available since the tag in the go.mod file of this repo" - tag_name: - description: "go-ipfs tag name, if a new tag is available" runs: using: 'docker' image: 'Dockerfile' diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh index fe50c73..d030429 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/check-for-new-ipfs-tag/entrypoint.sh @@ -12,7 +12,7 @@ echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" cd ../ # make the upgrade, if newer go-ipfs tags exist -if [[ "$CURRENT_IPFS_TAG" == "$LATEST_IPFS_TAG" ]]; then +if [ "$CURRENT_IPFS_TAG" = "$LATEST_IPFS_TAG" ]; then echo "http-api-docs already uses the latest go-ipfs tag." else cd http-api-docs diff --git a/.github/actions/latest-ipfs-tag/Dockerfile b/.github/actions/latest-ipfs-tag/Dockerfile new file mode 100644 index 0000000..34e65f5 --- /dev/null +++ b/.github/actions/latest-ipfs-tag/Dockerfile @@ -0,0 +1,3 @@ +FROM golang:1.17 +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/latest-ipfs-tag/action.yml b/.github/actions/latest-ipfs-tag/action.yml new file mode 100644 index 0000000..c16af5f --- /dev/null +++ b/.github/actions/latest-ipfs-tag/action.yml @@ -0,0 +1,7 @@ +name: 'Find latest go-ipfs tag' +outputs: + latest_tag: + description: "latest go-ipfs tag name" +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/latest-ipfs-tag/entrypoint.sh b/.github/actions/latest-ipfs-tag/entrypoint.sh new file mode 100755 index 0000000..b1c3331 --- /dev/null +++ b/.github/actions/latest-ipfs-tag/entrypoint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +set -eu + +# extract IPFS release +cd /tmp +git clone https://github.com/ipfs/go-ipfs.git +cd go-ipfs +LATEST_IPFS_TAG=`git describe --tags --abbrev=0` +echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" +echo "::set-output name=latest_tag::${LATEST_IPFS_TAG}" diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 0157bff..cad8eb1 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -11,18 +11,5 @@ jobs: steps: - name: Checkout http-api-docs uses: actions/checkout@v2 - with: - path: ./http-api-docs - - name: Checkout go-ipfs - uses: actions/checkout@v2 - with: - repository: ipfs/go-ipfs - path: ./go-ipfs - fetch-depth: 0 - # - name: List directories - # run: | - # ls -l - # ls -l ./http-api-docs - # ls -l ./go-ipfs - - name: Update http-api-docs, if necessary - uses: ./http-api-docs/.github/actions/check-for-new-ipfs-tag + - name: Find latest go-ipfs tag + uses: ./http-api-docs/.github/actions/latest-ipfs-tag From 217fe6c1953329b6ec68c4852547f4cac579cd3d Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:13:54 -0700 Subject: [PATCH 09/19] fix --- .github/workflows/update-on-new-ipfs-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index cad8eb1..dd55cf5 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -12,4 +12,4 @@ jobs: - name: Checkout http-api-docs uses: actions/checkout@v2 - name: Find latest go-ipfs tag - uses: ./http-api-docs/.github/actions/latest-ipfs-tag + uses: ./.github/actions/latest-ipfs-tag From 441cddebd477e4f0a9ebcc8ebf4ee12e6f10f39b Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:30:41 -0700 Subject: [PATCH 10/19] split into two actions --- .github/actions/check-for-new-ipfs-tag/action.yml | 4 ---- .github/actions/latest-ipfs-tag/action.yml | 2 +- .github/actions/latest-ipfs-tag/entrypoint.sh | 2 +- .../Dockerfile | 0 .github/actions/update-on-new-ipfs-tag/action.yml | 10 ++++++++++ .../entrypoint.sh | 8 ++------ .github/workflows/update-on-new-ipfs-tag.yml | 5 +++++ 7 files changed, 19 insertions(+), 12 deletions(-) delete mode 100644 .github/actions/check-for-new-ipfs-tag/action.yml rename .github/actions/{check-for-new-ipfs-tag => update-on-new-ipfs-tag}/Dockerfile (100%) create mode 100644 .github/actions/update-on-new-ipfs-tag/action.yml rename .github/actions/{check-for-new-ipfs-tag => update-on-new-ipfs-tag}/entrypoint.sh (79%) diff --git a/.github/actions/check-for-new-ipfs-tag/action.yml b/.github/actions/check-for-new-ipfs-tag/action.yml deleted file mode 100644 index 878d1ba..0000000 --- a/.github/actions/check-for-new-ipfs-tag/action.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: 'Check for a new go-ipfs tag' -runs: - using: 'docker' - image: 'Dockerfile' diff --git a/.github/actions/latest-ipfs-tag/action.yml b/.github/actions/latest-ipfs-tag/action.yml index c16af5f..e6df8a3 100644 --- a/.github/actions/latest-ipfs-tag/action.yml +++ b/.github/actions/latest-ipfs-tag/action.yml @@ -1,6 +1,6 @@ name: 'Find latest go-ipfs tag' outputs: - latest_tag: + latest-tag: description: "latest go-ipfs tag name" runs: using: 'docker' diff --git a/.github/actions/latest-ipfs-tag/entrypoint.sh b/.github/actions/latest-ipfs-tag/entrypoint.sh index b1c3331..d22fe44 100755 --- a/.github/actions/latest-ipfs-tag/entrypoint.sh +++ b/.github/actions/latest-ipfs-tag/entrypoint.sh @@ -7,4 +7,4 @@ git clone https://github.com/ipfs/go-ipfs.git cd go-ipfs LATEST_IPFS_TAG=`git describe --tags --abbrev=0` echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" -echo "::set-output name=latest_tag::${LATEST_IPFS_TAG}" +echo "::set-output name=latest-tag::${LATEST_IPFS_TAG}" diff --git a/.github/actions/check-for-new-ipfs-tag/Dockerfile b/.github/actions/update-on-new-ipfs-tag/Dockerfile similarity index 100% rename from .github/actions/check-for-new-ipfs-tag/Dockerfile rename to .github/actions/update-on-new-ipfs-tag/Dockerfile diff --git a/.github/actions/update-on-new-ipfs-tag/action.yml b/.github/actions/update-on-new-ipfs-tag/action.yml new file mode 100644 index 0000000..7602ed1 --- /dev/null +++ b/.github/actions/update-on-new-ipfs-tag/action.yml @@ -0,0 +1,10 @@ +name: 'Update on new go-ipfs tag' +inputs: + latest-ipfs-tag: + description: "latest go ipfs tag" + required: true +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.latest-ipfs-tag }} diff --git a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh similarity index 79% rename from .github/actions/check-for-new-ipfs-tag/entrypoint.sh rename to .github/actions/update-on-new-ipfs-tag/entrypoint.sh index d030429..bc27a91 100755 --- a/.github/actions/check-for-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh @@ -2,20 +2,17 @@ set -eu # extract go-ipfs release tag used in http-api-docs from go.mod in this repo -CURRENT_IPFS_TAG=`grep 'github.com/ipfs/go-ipfs ' ./http-api-docs/go.mod | awk '{print $2}'` +CURRENT_IPFS_TAG=`grep 'github.com/ipfs/go-ipfs ' ./go.mod | awk '{print $2}'` echo "The currently used IPFS tag is ${CURRENT_IPFS_TAG}" # extract IPFS release -cd go-ipfs -LATEST_IPFS_TAG=`git describe --tags --abbrev=0` +LATEST_IPFS_TAG=$1 echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" -cd ../ # make the upgrade, if newer go-ipfs tags exist if [ "$CURRENT_IPFS_TAG" = "$LATEST_IPFS_TAG" ]; then echo "http-api-docs already uses the latest go-ipfs tag." else - cd http-api-docs git checkout -b update-ipfs-to-$LATEST_IPFS_TAG sed "s/^\s*github.com\/ipfs\/go-ipfs\s\+$CURRENT_IPFS_TAG\s*$/ github.com\/ipfs\/go-ipfs $LATEST_IPFS_TAG/" go.mod > go.mod2 mv go.mod2 go.mod @@ -23,5 +20,4 @@ else make git add -u git commit -m "Bumped go-ipfs dependence to tag $LATEST_IPFS_TAG." - cd .. fi diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index dd55cf5..f115627 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -12,4 +12,9 @@ jobs: - name: Checkout http-api-docs uses: actions/checkout@v2 - name: Find latest go-ipfs tag + id: latest-ipfs uses: ./.github/actions/latest-ipfs-tag + - name: Update http-api-docs + uses: ./.github/actions/update-on-new-ipfs-tag + with: + latest-ipfs-tag: ${{ steps.latest-ipfs.latest-tag }} From cfe81320445514bd12653b5f462d079fcef7701f Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:36:43 -0700 Subject: [PATCH 11/19] ok --- .github/actions/update-on-new-ipfs-tag/action.yml | 2 -- .github/actions/update-on-new-ipfs-tag/entrypoint.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/update-on-new-ipfs-tag/action.yml b/.github/actions/update-on-new-ipfs-tag/action.yml index 7602ed1..1b3eab2 100644 --- a/.github/actions/update-on-new-ipfs-tag/action.yml +++ b/.github/actions/update-on-new-ipfs-tag/action.yml @@ -6,5 +6,3 @@ inputs: runs: using: 'docker' image: 'Dockerfile' - args: - - ${{ inputs.latest-ipfs-tag }} diff --git a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh index bc27a91..2ebef3b 100755 --- a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh @@ -6,7 +6,7 @@ CURRENT_IPFS_TAG=`grep 'github.com/ipfs/go-ipfs ' ./go.mod | awk '{print $2}'` echo "The currently used IPFS tag is ${CURRENT_IPFS_TAG}" # extract IPFS release -LATEST_IPFS_TAG=$1 +LATEST_IPFS_TAG=$INPUT_LATEST_IPFS_TAG echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" # make the upgrade, if newer go-ipfs tags exist From 61eb09bf46e950c119bfd803daddcfc47c08aba3 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:39:52 -0700 Subject: [PATCH 12/19] ok --- .github/actions/update-on-new-ipfs-tag/action.yml | 2 +- .github/workflows/update-on-new-ipfs-tag.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/update-on-new-ipfs-tag/action.yml b/.github/actions/update-on-new-ipfs-tag/action.yml index 1b3eab2..821f834 100644 --- a/.github/actions/update-on-new-ipfs-tag/action.yml +++ b/.github/actions/update-on-new-ipfs-tag/action.yml @@ -1,6 +1,6 @@ name: 'Update on new go-ipfs tag' inputs: - latest-ipfs-tag: + latest_ipfs_tag: description: "latest go ipfs tag" required: true runs: diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index f115627..ad3a51b 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -17,4 +17,4 @@ jobs: - name: Update http-api-docs uses: ./.github/actions/update-on-new-ipfs-tag with: - latest-ipfs-tag: ${{ steps.latest-ipfs.latest-tag }} + latest_ipfs_tag: ${{ steps.latest-ipfs.latest-tag }} From ff051bb06caf144b4bc29e23d6372aaec3dda8b4 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:45:53 -0700 Subject: [PATCH 13/19] ok --- .github/actions/latest-ipfs-tag/action.yml | 2 +- .github/actions/latest-ipfs-tag/entrypoint.sh | 2 +- .github/workflows/update-on-new-ipfs-tag.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/latest-ipfs-tag/action.yml b/.github/actions/latest-ipfs-tag/action.yml index e6df8a3..c16af5f 100644 --- a/.github/actions/latest-ipfs-tag/action.yml +++ b/.github/actions/latest-ipfs-tag/action.yml @@ -1,6 +1,6 @@ name: 'Find latest go-ipfs tag' outputs: - latest-tag: + latest_tag: description: "latest go-ipfs tag name" runs: using: 'docker' diff --git a/.github/actions/latest-ipfs-tag/entrypoint.sh b/.github/actions/latest-ipfs-tag/entrypoint.sh index d22fe44..b1c3331 100755 --- a/.github/actions/latest-ipfs-tag/entrypoint.sh +++ b/.github/actions/latest-ipfs-tag/entrypoint.sh @@ -7,4 +7,4 @@ git clone https://github.com/ipfs/go-ipfs.git cd go-ipfs LATEST_IPFS_TAG=`git describe --tags --abbrev=0` echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" -echo "::set-output name=latest-tag::${LATEST_IPFS_TAG}" +echo "::set-output name=latest_tag::${LATEST_IPFS_TAG}" diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index ad3a51b..2286f76 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -12,9 +12,9 @@ jobs: - name: Checkout http-api-docs uses: actions/checkout@v2 - name: Find latest go-ipfs tag - id: latest-ipfs + id: latest_ipfs uses: ./.github/actions/latest-ipfs-tag - name: Update http-api-docs uses: ./.github/actions/update-on-new-ipfs-tag with: - latest_ipfs_tag: ${{ steps.latest-ipfs.latest-tag }} + latest_ipfs_tag: ${{ steps.latest_ipfs.latest_tag }} From 84a29e03c74bf767310c1582a0e07a64a1abd00d Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:51:49 -0700 Subject: [PATCH 14/19] ok --- .github/workflows/update-on-new-ipfs-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 2286f76..f36e517 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -17,4 +17,4 @@ jobs: - name: Update http-api-docs uses: ./.github/actions/update-on-new-ipfs-tag with: - latest_ipfs_tag: ${{ steps.latest_ipfs.latest_tag }} + latest_ipfs_tag: ${{ steps.latest_ipfs.outputs.latest_tag }} From dc932b67870e52b067012f5e583d68c16dc0b395 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 07:56:04 -0700 Subject: [PATCH 15/19] ok --- .github/actions/update-on-new-ipfs-tag/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh index 2ebef3b..25f082e 100755 --- a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh @@ -18,6 +18,8 @@ else mv go.mod2 go.mod go mod tidy make + git config --global user.email "doc-update-bot@protocol.ai" + git config --global user.name "PL docs update bot" git add -u git commit -m "Bumped go-ipfs dependence to tag $LATEST_IPFS_TAG." fi From eef598ecbad96d9a3acda29fc4728af85f719edf Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 08:01:14 -0700 Subject: [PATCH 16/19] ok --- .github/workflows/update-on-new-ipfs-tag.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index f36e517..ab54cb3 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -18,3 +18,5 @@ jobs: uses: ./.github/actions/update-on-new-ipfs-tag with: latest_ipfs_tag: ${{ steps.latest_ipfs.outputs.latest_tag }} + - name: pull-request + uses: repo-sync/pull-request@v2 From 68db365cfcea2e24ab2e4fb063bb3daa17ac0598 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 08:04:04 -0700 Subject: [PATCH 17/19] ok --- .github/workflows/update-on-new-ipfs-tag.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index ab54cb3..cd06202 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -20,3 +20,5 @@ jobs: latest_ipfs_tag: ${{ steps.latest_ipfs.outputs.latest_tag }} - name: pull-request uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} From 5dcd8dc81cc64c662805ff2588824f6ff6d24317 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 09:36:35 -0700 Subject: [PATCH 18/19] ok --- .github/actions/update-on-new-ipfs-tag/action.yml | 3 +++ .github/actions/update-on-new-ipfs-tag/entrypoint.sh | 6 ++++-- .github/workflows/update-on-new-ipfs-tag.yml | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/actions/update-on-new-ipfs-tag/action.yml b/.github/actions/update-on-new-ipfs-tag/action.yml index 821f834..29486c9 100644 --- a/.github/actions/update-on-new-ipfs-tag/action.yml +++ b/.github/actions/update-on-new-ipfs-tag/action.yml @@ -3,6 +3,9 @@ inputs: latest_ipfs_tag: description: "latest go ipfs tag" required: true +outputs: + updated_branch: + description: "name of pushed branch with updated doc" runs: using: 'docker' image: 'Dockerfile' diff --git a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh index 25f082e..2275c4b 100755 --- a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh +++ b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh @@ -18,8 +18,10 @@ else mv go.mod2 go.mod go mod tidy make - git config --global user.email "doc-update-bot@protocol.ai" - git config --global user.name "PL docs update bot" + git config --global user.email "${GITHUB_ACTOR}" + git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com" git add -u git commit -m "Bumped go-ipfs dependence to tag $LATEST_IPFS_TAG." + git push -u origin update-ipfs-to-$LATEST_IPFS_TAG fi +echo "::set-output name=updated_branch::update-ipfs-to-$LATEST_IPFS_TAG" diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index cd06202..b7eb8ae 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -15,10 +15,12 @@ jobs: id: latest_ipfs uses: ./.github/actions/latest-ipfs-tag - name: Update http-api-docs + id: update uses: ./.github/actions/update-on-new-ipfs-tag with: latest_ipfs_tag: ${{ steps.latest_ipfs.outputs.latest_tag }} - - name: pull-request + - name: pull-request # don't create a pr if there was no new ipfs tag uses: repo-sync/pull-request@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} + source_branch: ${{ steps.update.outputs.updated_branch }} \ No newline at end of file From 796a69bba04b854cda60cec7cb17de472d1bc407 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 8 Sep 2021 10:11:01 -0700 Subject: [PATCH 19/19] add pr title --- .github/workflows/update-on-new-ipfs-tag.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index b7eb8ae..745009f 100644 --- a/.github/workflows/update-on-new-ipfs-tag.yml +++ b/.github/workflows/update-on-new-ipfs-tag.yml @@ -23,4 +23,5 @@ jobs: uses: repo-sync/pull-request@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} - source_branch: ${{ steps.update.outputs.updated_branch }} \ No newline at end of file + source_branch: ${{ steps.update.outputs.updated_branch }} + pr_title: "Bump go-ipfs dependency to ${{ steps.latest_ipfs.outputs.latest_tag }}" \ No newline at end of file