diff --git a/.github/actions/update-on-new-ipfs-tag/Dockerfile b/.github/actions/update-on-new-ipfs-tag/Dockerfile deleted file mode 100644 index 34e65f502..000000000 --- a/.github/actions/update-on-new-ipfs-tag/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM golang:1.17 -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh b/.github/actions/update-on-new-ipfs-tag/entrypoint.sh deleted file mode 100755 index f7d974d2d..000000000 --- a/.github/actions/update-on-new-ipfs-tag/entrypoint.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -set -eu - -API_FILE=`pwd`/docs/reference/http/api.md -ROOT=`pwd` -cd tools/http-api-docs - -# 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 ' ./go.mod | awk '{print $2}'` -echo "The currently used go-ipfs tag in http-api-docs is ${CURRENT_IPFS_TAG}" - -# extract IPFS release -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 -if [ "$CURRENT_IPFS_TAG" = "$LATEST_IPFS_TAG" ]; then - echo "http-api-docs already uses the latest go-ipfs tag." -else - # update http-api-docs - git checkout -b bump-http-api-docs-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 - http-api-docs > $API_FILE - - # update installation docs - cd $ROOT # go back to root of ipfs-docs repo - CURRENT_IPFS_NUMBER=${CURRENT_IPFS_TAG:1} - LATEST_IPFS_NUMBER=${LATEST_IPFS_TAG:1} - while read -r file; do - echo "replacing $CURRENT_IPFS_NUMBER with $LATEST_IPFS_NUMBER in $file" - sed -E -i "s/$CURRENT_IPFS_NUMBER/$LATEST_IPFS_NUMBER/g" $file - done <<< "$(grep "current-ipfs-version" ./docs -R --files-with-matches)" - - # update cli docs - cd $ROOT # go back to root of ipfs-docs repo - git clone https://github.com/ipfs/go-ipfs.git - cd go-ipfs - git fetch --all --tags - git checkout tags/$LATEST_IPFS_TAG - go install ./cmd/ipfs - cd $ROOT/docs/reference - ./generate-cli-docs.sh - - # submit a PR - cd $ROOT # go back to root of ipfs-docs repo - 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 of http-api-docs to tag $LATEST_IPFS_TAG." - git push -u origin bump-http-api-docs-ipfs-to-$LATEST_IPFS_TAG - echo "::set-output name=updated_branch::bump-http-api-docs-ipfs-to-$LATEST_IPFS_TAG" -fi diff --git a/.github/actions/update-with-latest-versions/Dockerfile b/.github/actions/update-with-latest-versions/Dockerfile new file mode 100644 index 000000000..3de042c7c --- /dev/null +++ b/.github/actions/update-with-latest-versions/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.17 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/update-on-new-ipfs-tag/action.yml b/.github/actions/update-with-latest-versions/action.yml similarity index 78% rename from .github/actions/update-on-new-ipfs-tag/action.yml rename to .github/actions/update-with-latest-versions/action.yml index 29486c92c..53de97d6f 100644 --- a/.github/actions/update-on-new-ipfs-tag/action.yml +++ b/.github/actions/update-with-latest-versions/action.yml @@ -1,4 +1,4 @@ -name: 'Update on new go-ipfs tag' +name: 'Update when a new tag or a new release is available' inputs: latest_ipfs_tag: description: "latest go ipfs tag" diff --git a/.github/actions/update-with-latest-versions/entrypoint.sh b/.github/actions/update-with-latest-versions/entrypoint.sh new file mode 100755 index 000000000..72682276b --- /dev/null +++ b/.github/actions/update-with-latest-versions/entrypoint.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +set -eu + +BRANCH=bump-documentation-to-latest-versions +LATEST_IPFS_TAG=$INPUT_LATEST_IPFS_TAG + +echo "The latest IPFS tag is ${LATEST_IPFS_TAG}" + +ROOT=`pwd` +git checkout -b ${BRANCH} +API_FILE=`pwd`/docs/reference/http/api.md + + +# Update http api docs and cli docs + +cd tools/http-api-docs + +# 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 ' ./go.mod | awk '{print $2}'` +echo "The currently used go-ipfs tag in http-api-docs is ${CURRENT_IPFS_TAG}" + +# 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 + # update http-api-docs + 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 + http-api-docs > $API_FILE + + # update cli docs + cd $ROOT # go back to root of ipfs-docs repo + git clone https://github.com/ipfs/go-ipfs.git + cd go-ipfs + git fetch --all --tags + git checkout tags/$LATEST_IPFS_TAG + go install ./cmd/ipfs + cd $ROOT/docs/reference + ./generate-cli-docs.sh +fi + + +# Update external tools versions + +update_version() { + INPUT_REPOSITORY=$1 + INPUT_VERSION_IDENTIFIER=$2 + + LATEST_VERSION_TAG=`curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${INPUT_REPOSITORY}/releases/latest | jq --raw-output ".tag_name"` + LATEST_VERSION_NUMBER=${LATEST_VERSION_TAG:1} + + echo "Updating documentation files that rely on ${INPUT_VERSION_IDENTIFIER} to ${LATEST_VERSION_TAG}" + + while read -r file; do + echo "updating ${INPUT_REPOSITORY} version to ${LATEST_VERSION_NUMBER} in ${file}" + CURRENT_VERSION_TAG=`awk "/${INPUT_VERSION_IDENTIFIER}/{print \\$2; exit;}" "${file}"` + CURRENT_VERSION_NUMBER=${CURRENT_VERSION_TAG:1} + sed -E -i "s/$CURRENT_VERSION_NUMBER/$LATEST_VERSION_NUMBER/g" ${file} + done <<< "$(grep "${INPUT_VERSION_IDENTIFIER}" ./docs -R --files-with-matches)" +} + +cd "${ROOT}" +update_version ipfs/ipfs-update current-ipfs-updater-version +update_version ipfs/ipfs-cluster current-ipfs-cluster-version +update_version ipfs/go-ipfs current-ipfs-version + + +# Push on change + +if [[ ! `git status --porcelain` ]]; then + echo "No changes to commit." + exit 0; +fi + +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 documentation & installation docs." +git push -fu origin ${BRANCH} +echo "::set-output name=updated_branch::${BRANCH}" \ No newline at end of file diff --git a/.github/workflows/update-on-new-ipfs-tag.yml b/.github/workflows/update-on-new-ipfs-tag.yml index 9d770f6f0..5a1101b13 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 docs on new ipfs-tag release +name: Update docs on new version (ipfs, ipfs-cluster, etc.) on: workflow_dispatch: schedule: - cron: '30 5,17 * * *' # run every day at 5:30am and 5:30pm UTC + workflow_call: jobs: update: @@ -13,18 +14,19 @@ jobs: - name: Find latest go-ipfs tag id: latest_ipfs uses: ./.github/actions/latest-ipfs-tag - - name: Update http-api-docs + - name: Update docs id: update - uses: ./.github/actions/update-on-new-ipfs-tag + uses: ./.github/actions/update-with-latest-versions with: latest_ipfs_tag: ${{ steps.latest_ipfs.outputs.latest_tag }} - - name: pull-request # don't create a pr if there was no new ipfs tag - uses: repo-sync/pull-request@65194d8015be7624d231796ddee1cd52a5023cb3 #v2.16 - if: ${{ steps.update.outputs.updated_branch }} + - name: pull-request + uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde #v2.6.2 + if: ${{ steps.update.outputs.updated_branch }} # don't create a pr if there was no branch pushed with: github_token: ${{ secrets.GITHUB_TOKEN }} source_branch: ${{ steps.update.outputs.updated_branch }} destination_branch: "main" - pr_title: "Bump references to go-ipfs ${{ steps.latest_ipfs.outputs.latest_tag }}" + pr_title: "Update documentation ${{ steps.latest_ipfs.outputs.latest_tag }}" pr_body: "Release Notes: https://github.com/ipfs/go-ipfs/releases/${{ steps.latest_ipfs.outputs.latest_tag }}" pr_label: "needs/triage,P0" + diff --git a/docs/install/ipfs-updater.md b/docs/install/ipfs-updater.md index 5caa33d15..4d014fe39 100644 --- a/docs/install/ipfs-updater.md +++ b/docs/install/ipfs-updater.md @@ -1,6 +1,7 @@ --- title: IPFS updater description: The IPFS updater is a command-line tool originally used to help users update their IPFS version. Learn how to install, upgrade, and downgrade Go-IPFS using the IPFS updater. +current-ipfs-updater-version: v1.8.0 --- # IPFS updater diff --git a/docs/install/server-infrastructure.md b/docs/install/server-infrastructure.md index d5eae42e9..733e464ac 100644 --- a/docs/install/server-infrastructure.md +++ b/docs/install/server-infrastructure.md @@ -1,6 +1,7 @@ --- title: Server infrastructure description: IPFS Cluster provides data orchestration across a swarm of IPFS daemons by allocating, replicating, and tracking a global pin-set distributed among multiple peers. Learn how to install it here. +current-ipfs-cluster-version: v1.0.1 --- # Server infrastructure @@ -37,13 +38,13 @@ If you're having issues here, head over to the [official Docker documentation to 1. Download the latest `ipfs-cluster-ctl` package from [dist.ipfs.io](https://dist.ipfs.io/#ipfs-cluster-ctl): ```shell - wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.0-rc4/ipfs-cluster-ctl_v1.0.0-rc4_linux-amd64.tar.gz + wget https://dist.ipfs.io/ipfs-cluster-ctl/v1.0.1/ipfs-cluster-ctl_v1.0.1_linux-amd64.tar.gz ``` 1. Unzip the package: ```shell - tar xvzf ipfs-cluster-ctl_v1.0.0-rc4_linux-amd64.tar.gz + tar xvzf ipfs-cluster-ctl_v1.0.1_linux-amd64.tar.gz > ipfs-cluster-ctl/ipfs-cluster-ctl > ipfs-cluster-ctl/LICENSE @@ -52,10 +53,10 @@ If you're having issues here, head over to the [official Docker documentation to > ipfs-cluster-ctl/README.md ``` -1. Download the [`docker-compose.yml` file](https://raw.githubusercontent.com/ipfs/ipfs-cluster/v1.0.0-rc4/docker-compose.yml) and place it into the `ipfs-cluster-ctl` directory: +1. Download the [`docker-compose.yml` file](https://raw.githubusercontent.com/ipfs/ipfs-cluster/v1.0.1/docker-compose.yml) and place it into the `ipfs-cluster-ctl` directory: ```shell - wget https://raw.githubusercontent.com/ipfs/ipfs-cluster/v1.0.0-rc4/docker-compose.yml + wget https://raw.githubusercontent.com/ipfs/ipfs-cluster/v1.0.1/docker-compose.yml ``` 1. Start the cluster using `docker-compose`. You may have to run as root: