Skip to content

Commit

Permalink
relese checks: ensure they can run on pull requests
Browse files Browse the repository at this point in the history
Releases only happen when pushing tags.

MacOS integration test disabled for the moment as plugins don't
run with darwin dist builds due to cross-platform builds
(must self-compile).
  • Loading branch information
hsanjuan committed Jun 26, 2023
1 parent d6b56b9 commit 909afaa
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Kubo plugin build, test, release
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:
Expand All @@ -26,7 +31,7 @@ jobs:
- name: Package plugin
run: make dist-plugin
- name: Record Go environment
run: go env >> "$GITHUB_ENV"
run: go env >> "$GITHUB_ENV"
- name: Rename package
run: |
NAME="nopfs-kubo-plugin_${{ env.RELEASE }}_${{ env.GOHOSTOS }}_${{ env.GOHOSTARCH }}.tar.gz"
Expand All @@ -39,12 +44,14 @@ jobs:
path: nopfs-kubo-plugin_*.tar.gz

test-artifacts:
name: "Test"
needs: build-artifacts
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
# macos test fail with dist-built ipfs.
# - macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -54,31 +61,38 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Set Kubo version
- name: Record variables
run: |
V=`cat nopfs-kubo-plugin/go.mod | grep github.com/ipfs/kubo | grep -o 'v.*'`
echo "KUBO_VERSION=$V" >> "$GITHUB_ENV"
GOHOSTOS=`go env GOHOSTOS`
echo "GOHOSTOS=$GOHOSTOS" >> "$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: nopfs-kubo-plugin_*_${{ env.OS }}_amd64.tar.gz
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
wget -nv 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
tar -xf nopfs-kubo-plugin_*.tar.gz
chmod +x kubo/ipfs
- name: Initialize IPFS and copy plugin
run: |
export IPFS_PATH=$(pwd)/ipfs-config
ipfs init
echo "IPFS_PATH=$IPFS_PATH" >> "$GITHUB_ENV"
./kubo/ipfs init
mkdir -p ipfs-config/plugins
cp nopfs-kubo-plugin/nopfs-kubo-plugin ipfs-config/plugins/
- name: Check IPFS works with the plugin
run: ipfs version --all
run: ./kubo/ipfs version --all

release:
name: "Release"
needs: test-artifacts
runs-on: ubuntu-latest
steps:
Expand All @@ -88,16 +102,16 @@ jobs:
- name: Extract release name from tag
run: |
RELEASE=$(basename ${{ github.ref_name }})
echo "RELEASE=$RELEASE" >> "$GITHUB_ENV"
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`.
To install, download the relevant asset for your platform, unpack the plugin file (`nopfs-kubo-plugin`) and place it in `~/.ipfs/plugins`. MacOS users will need to compile Kubo themselves, as the official releases have no CGO support.
See the included README.md for more information.
name: ${{ github.ref_name }}

0 comments on commit 909afaa

Please sign in to comment.