-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (112 loc) · 3.88 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Kubo plugin
on:
push:
env:
# must be same as official ipfs builds. See distributions/.tool-versions
GO_VERSION: "1.21.1"
jobs:
build-artifacts:
name: "Build"
strategy:
matrix:
os:
- ubuntu-20.04
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
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: |
echo "GOHOSTOS=$(go env GOHOSTOS)" >> "$GITHUB_ENV"
echo "GOHOSTARCH=$(go env GOHOSTARCH)" >> "$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-20.04
# macos test fail with dist-built ipfs.
# - macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_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: ${{ env.PLUGIN_ARTIFACT }}
- name: Download unpack Kubo
run: |
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_*.tar.gz
chmod +x kubo/ipfs
- name: Initialize IPFS and copy plugin
run: |
export IPFS_PATH=$(pwd)/ipfs-config
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: ./kubo/ipfs version --all
release:
name: "Release"
needs: test-artifacts
runs-on: ubuntu-20.04
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`. 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 }}