Skip to content

Workflow file for this run

name: Kubo plugin
on:
push:
env:
GO_VERSION: "1.19.10" # must be same as official ipfs builds
jobs:
build-artifacts:
name: "Build"
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Extract release name from tag
run: |
RELEASE=$(basename ${{ github.ref_name }})
echo "RELEASE=$RELEASE" >> "$GITHUB_ENV"
- name: Package plugin
run: make dist-plugin
- name: Record Go environment
run: go env >> "$GITHUB_ENV"
- name: Rename package
run: |
NAME="nopfs-kubo-plugin_${{ env.RELEASE }}_${{ env.GOHOSTOS }}_${{ env.GOHOSTARCH }}.tar.gz"
mv nopfs-kubo-plugin/nopfs-kubo-plugin.tar.gz "$NAME"
echo "ARTIFACT_NAME=$NAME" >> "$GITHUB_ENV"
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: nopfs-kubo-plugin_*.tar.gz
test-artifacts:
name: "Test"
needs: build-artifacts
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Record Go environment
run: go env >> "$GITHUB_ENV"
- name: Set Kubo version
run: |
V=`cat nopfs-kubo-plugin/go.mod | grep github.com/ipfs/kubo | grep -o 'v.*'`
echo "KUBO_VERSION=$V" >> "$GITHUB_ENV"
RELEASE=$(basename ${{ github.ref_name }})
echo "RELEASE=$RELEASE" >> "$GITHUB_ENV"
echo "PLUGIN_ARTIFACT=nopfs-kubo-plugin_${RELEASE}_${GOHOSTOS}_amd64.tar.gz" >> "$GITHUB_ENV"
- name: Download artifact
id: download
uses: actions/download-artifact@v3
with:
name: ${{ env.PLUGIN_ARTIFACT }}
- name: Download unpack Kubo
run: |
wget https://dist.ipfs.tech/kubo/${{ env.KUBO_VERSION }}/kubo_${{ env.KUBO_VERSION }}_${{ env.GOHOSTOS }}-amd64.tar.gz
tar -xf kubo_${{ env.KUBO_VERSION }}_${{ env.GOHOSTOS }}-amd64.tar.gz
tar -xf nopfs-kubo-plugin_*
cp kubo/ipfs .
chmod +x ipfs
- name: Initialize IPFS and copy plugin
run: |
export IPFS_PATH=$(pwd)/ipfs-config
ipfs init
cp nopfs-kubo-plugin/nopfs-kubo-plugin ipfs-config/plugins/
- name: Check IPFS works with the plugin
run: ipfs version --all
release:
name: "Release"
needs: test-artifacts
runs-on: ubuntu-latest
steps:
- name: Download artifacts
id: download
uses: actions/download-artifact@v3
- name: Extract release name from tag
run: |
RELEASE=$(basename ${{ github.ref_name }})
echo "RELEASE=$RELEASE" >> "$GITHUB_ENV"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/nopfs-kubo-plugin/v')
with:
files: nopfs-kubo-plugin_*.tar.gz/*
body: |
This is a binary build of the NOpfs Kubo plugin targeting Kubo version ${{ env.RELEASE }}.
To install, download the relevant asset for your platform, unpack the plugin file (`nopfs-kubo-plugin`) and place it in `~/.ipfs/plugins`.
See the included README.md for more information.
name: ${{ github.ref_name }}