Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump CLI and HTTP API reference to go-ipfs v0.9.1 #884

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/latest-ipfs-tag/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM golang:1.17
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
7 changes: 7 additions & 0 deletions .github/actions/latest-ipfs-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Find latest go-ipfs tag'
outputs:
latest_tag:
description: "latest go-ipfs tag name"
runs:
using: 'docker'
image: 'Dockerfile'
10 changes: 10 additions & 0 deletions .github/actions/latest-ipfs-tag/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}"
3 changes: 3 additions & 0 deletions .github/actions/update-on-new-ipfs-tag/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM golang:1.17
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
11 changes: 11 additions & 0 deletions .github/actions/update-on-new-ipfs-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Update on new go-ipfs tag'
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'
46 changes: 46 additions & 0 deletions .github/actions/update-on-new-ipfs-tag/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
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 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
fi
echo "::set-output name=updated_branch::bump-http-api-docs-ipfs-to-$LATEST_IPFS_TAG"
30 changes: 30 additions & 0 deletions .github/workflows/update-on-new-ipfs-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Update docs on new ipfs-tag release
on:
push:
# 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 ipfs-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
id: update
uses: ./.github/actions/update-on-new-ipfs-tag
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
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: ${{ steps.update.outputs.updated_branch }}
destination_branch: "main"
pr_title: "Bump CLI and HTTP API reference to go-ipfs ${{ 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"
34 changes: 17 additions & 17 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ description: API documentation for the Go-IPFS command-line executable.

<!-- DO NOT EDIT THIS FILE. This file is auto-generated from `generate-cli-docs.sh`. Any changes you make to this file will be overwritten. To edit this file, change the contents of the `generate-cli-docs.sh` script. -->

IPFS can run in either _online_ or _offline_ mode. Online mode is when you have IPFS running separately as a daemon process. If you do not have an IPFS daemon running, you are in offline mode. Some commands, like `ipfs swarm peers`, are only supported when online. The [command-line quickstart guide](../how-to/command-line-quick-start.md#take-your-node-online) explains how to start the IPFS daemon and take your node online.
IPFS can run in either _online_ or _offline_ mode. Online mode is when you have IPFS running separately as a daemon process. If you do not have an IPFS daemon running, you are in offline mode. Some commands, like `ipfs swarm peers`, are only supported when online. The [command-line quickstart guide](../how-to/command-line-quick-start/#take-your-node-online) explains how to start the IPFS daemon and take your node online.



### Alignment with HTTP API

Every command usable from the CLI is also available through the [HTTP API](http/api.md). For example:
Every command usable from the CLI is also available through the [HTTP API](/reference/http/api). For example:

```sh
> ipfs swarm peers
Expand All @@ -32,7 +32,7 @@ Every command usable from the CLI is also available through the [HTTP API](http/
```


_Generated on 2021-06-23 12:01:39, from go-ipfs 0.9.0._
_Generated on 2021-09-20 21:03:27, from go-ipfs 0.9.1._

## ipfs

Expand Down Expand Up @@ -891,29 +891,24 @@ SYNOPSIS
DESCRIPTION

Available profiles:
'server':
Disables local host discovery, recommended when
running IPFS on machines with public IPv4 addresses.
'local-discovery':
Sets default values to fields affected by the server
profile, enables discovery in local networks.
'test':
Reduces external interference of IPFS daemon, this
is useful when using the daemon in test environments.
'default-datastore':
Configures the node to use the default datastore (flatfs).

Read the "flatfs" profile description for more information on this datastore.

This profile may only be applied when first initializing the node.

'lowpower':
Reduces daemon overhead on the system. May affect node
functionality - performance of content discovery and data
fetching may be degraded.

'randomports':
Use a random port number for swarm.
'server':
Disables local host discovery, recommended when
running IPFS on machines with public IPv4 addresses.
'local-discovery':
Sets default values to fields affected by the server
profile, enables discovery in local networks.
'test':
Reduces external interference of IPFS daemon, this
is useful when using the daemon in test environments.
'default-networking':
Restores default network settings.
Inverse profile of the test profile.
Expand Down Expand Up @@ -949,6 +944,11 @@ DESCRIPTION
* This datastore uses up to several gigabytes of memory.

This profile may only be applied when first initializing the node.
'lowpower':
Reduces daemon overhead on the system. May affect node
functionality - performance of content discovery and data
fetching may be degraded.


SUBCOMMANDS
ipfs config profile apply <profile> - Apply profile to config.
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/http/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: HTTP API reference for IPFS, the InterPlanetary File System.
<!-- TODO: Describe how to change ports and configure the API server -->
<!-- TODO: Structure this around command groups (dag, object, files, etc.) -->

_Generated on 2021-06-23, from go-ipfs v0.9.0._
_Generated on 2021-09-20, from go-ipfs v0.9.1._

When an IPFS node is running as a daemon, it exposes an HTTP API that allows you to control the node and run the same commands you can from the command line.

Expand Down Expand Up @@ -55,7 +55,7 @@ Arguments are added through the special query string key "arg":
}
```

Note that it can be used multiple times to signify multiple arguments. Boolean `bool` values may have the value `true` or `false`.
Note that it can be used multiple times to signify multiple arguments.

### Flags

Expand Down Expand Up @@ -739,7 +739,7 @@ Format and convert a CID in various useful ways.
### Arguments

- `arg` [string]: Cids to format. Required: **yes**.
- `f` [string]: Printf style format string. Default: %!s(MISSING). Default: `%!s(MISSING)`. Required: no.
- `f` [string]: Printf style format string. Default: %s. Default: `%s`. Required: no.
- `v` [string]: CID version to convert to. Required: no.
- `codec` [string]: CID codec to convert to. Required: no.
- `b` [string]: Multibase to display CID in. Required: no.
Expand Down
21 changes: 21 additions & 0 deletions tools/http-api-docs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Hector Sanjuan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions tools/http-api-docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
all: install
install:
GO111MODULE=on go install ./http-api-docs
54 changes: 54 additions & 0 deletions tools/http-api-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# http-api-docs

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Build Status](https://travis-ci.com/ipfs/http-api-docs.svg?branch=master)](https://travis-ci.org/ipfs/http-api-docs)

> A generator for go-ipfs API endpoints documentation.

Note: This is just the generator for the docs that are available on ipfs.io, which can be found here: https://docs.ipfs.io/reference/http/api/

The original docs are written in Markdown format and are available for community contributions here: https://github.com/ipfs/ipfs-docs

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Captain](#captain)
- [Contribute](#contribute)
- [License](#license)

## Install

In order to build this project, you need to first install Go, clone this repo, and finally run `make install`:

```sh
> git clone https://github.com/ipfs/http-api-docs "$(go env GOPATH)/src/github.com/ipfs/http-api-docs"
> cd "$(go env GOPATH)/src/github.com/ipfs/http-api-docs"
> make install
```

## Usage

After installing you can run:

```
> http-api-docs
```

This should spit out a Markdown document. This is exactly the `api.md` documentation at https://github.com/ipfs/ipfs-docs/blob/master/docs/reference/http/api.md, so you can redirect the output to just overwrite that file.

## Captain

This project is captained by @hsanjuan.

## Contribute

PRs accepted.

Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT (C) Protocol Labs, Inc.
Loading