From 92ebb84eb7b097822b85511dd96b2487a7f29904 Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 22 Aug 2020 01:52:29 +0800 Subject: [PATCH] Add workflows --- .github/workflows/go.yml | 34 ++++++++++++++++++++++++++ .github/workflows/snapcraft.yml | 43 +++++++++++++++++++++++++++++++++ README.md | 2 ++ snapcraft.yaml | 39 ++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/snapcraft.yml create mode 100644 snapcraft.yaml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..9641c86 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: Test + run: go test -v ./... diff --git a/.github/workflows/snapcraft.yml b/.github/workflows/snapcraft.yml new file mode 100644 index 0000000..b7d8c2f --- /dev/null +++ b/.github/workflows/snapcraft.yml @@ -0,0 +1,43 @@ +name: Snapcraft Release + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + snapcraft-release: + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Snapcraft + run: | + sudo snap install snapcraft --classic + sudo snap install lxd + sudo usermod --append --groups lxd $USER + echo "::add-path::/snap/bin" + sudo chown root:root / + sudo /snap/bin/lxd.migrate -yes + sudo /snap/bin/lxd waitready + sudo /snap/bin/lxd init --auto + + # You can now run Snapcraft shell commands + - name: Use Snapcraft + run: snapcraft --help + + - name: Login snapcraft + run: | + LOGIN_FILEPATH=/tmp/credential + echo "${{ secrets.SNAPCRAFT_TOKEN }}" > $LOGIN_FILEPATH + snapcraft login --with $LOGIN_FILEPATH + + - name: Build snap + run: sg lxd -c 'snapcraft --use-lxd' + + - name: Publish snap + run: | + snapcraft push ipfs-pinner_0+git.$(git rev-parse --short HEAD)_amd64.snap --release=stable,edge + diff --git a/README.md b/README.md index 82d5549..b926c7c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ipfs-pinner +[![ipfs-pinner](https://snapcraft.io/ipfs-pinner/badge.svg)](https://snapcraft.io/ipfs-pinner) + `ipfs-pinner` is a toolkit to help upload files or specific content id to IPFS pinning services. ## Installation diff --git a/snapcraft.yaml b/snapcraft.yaml new file mode 100644 index 0000000..1ddb015 --- /dev/null +++ b/snapcraft.yaml @@ -0,0 +1,39 @@ +name: ipfs-pinner + +version: 'git' + +summary: A toolkit to upload files to IPFS pinning services. + +description: | + ipfs-pinner is a toolkit to help upload files or specific content id to IPFS pinning services. + Website https://github.com/wabarc/ipfs-pinner + + Supported Pinning Services: + + 1.Infura + Infura is a freemium pinning service that doesn't require any additional setup. It's the default one used. + Please bear in mind that Infura is a free service, so there is probably a rate-limiting. https://infura.io + Usage:ipfs-pinner file-to-path + + 2.Pinata + Pinata is a freemium pinning service. It gives you more control over what's uploaded. + You can delete, label and add custom metadata. This service requires signup. https://pinata.cloud/ + Usage:ipfs-pinner -p pinata file-to-path + +grade: stable + +confinement: strict + +base: core18 + +parts: + ipfs-pinner: + plugin: go + source: https://github.com/wabarc/ipfs-pinner.git + go-importpath: github.com/wabarc/ipfs-pinner/cmd/ipfs-pinner + build-packages: + - build-essential + +apps: + ipfs-pinner: + command: ipfs-pinner