Skip to content

Commit f84838d

Browse files
authored
Merge pull request #28 from AkihiroSuda/dev
Add .github/workflows/release.yml
2 parents d1464b9 + b1946a6 commit f84838d

File tree

7 files changed

+115
-2
lines changed

7 files changed

+115
-2
lines changed

.github/workflows/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@master
1919
- run: make test
20+
cross:
21+
runs-on: ubuntu-20.04
22+
timeout-minutes: 30
23+
steps:
24+
- uses: actions/checkout@master
25+
- run: make artifacts

.github/workflows/release.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
- 'test-action-release-*'
7+
env:
8+
GO111MODULE: on
9+
jobs:
10+
release:
11+
runs-on: ubuntu-20.04
12+
timeout-minutes: 20
13+
steps:
14+
- uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.16.x
17+
- uses: actions/checkout@v2
18+
with:
19+
path: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
20+
- name: "Compile binaries"
21+
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
22+
run: make artifacts
23+
- name: "SHA256SUMS"
24+
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
25+
run: |
26+
( cd _output; sha256sum containerd-fuse-overlayfs-* ) | tee /tmp/SHA256SUMS
27+
mv /tmp/SHA256SUMS _output/SHA256SUMS
28+
- name: "The sha256sum of the SHA256SUMS file"
29+
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
30+
run: (cd _output; sha256sum SHA256SUMS)
31+
- name: "Prepare the release note"
32+
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
33+
run: |
34+
tag="${GITHUB_REF##*/}"
35+
shasha=$(sha256sum _output/SHA256SUMS | awk '{print $1}')
36+
cat <<-EOF | tee /tmp/release-note.txt
37+
${tag}
38+
39+
(To be documented)
40+
- - -
41+
The binaries were built automatically on GitHub Actions.
42+
The build log is available for 90 days: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
43+
44+
The sha256sum of the SHA256SUMS file itself is \`${shasha}\` .
45+
EOF
46+
- name: "Create release"
47+
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
tag="${GITHUB_REF##*/}"
52+
asset_flags=()
53+
for f in _output/*; do asset_flags+=("-a" "$f"); done
54+
hub release create "${asset_flags[@]}" -F /tmp/release-note.txt --draft "${tag}"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.test
22
bin
3+
/_output

Makefile

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
DESTDIR ?= /usr/local
22

3+
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
4+
VERSION_TRIMMED := $(VERSION:v%=%)
5+
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
6+
7+
PKG_MAIN := github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc
8+
PKG_VERSION := github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc/version
9+
10+
GO ?= go
11+
export GO_BUILD=GO111MODULE=on CGO_ENABLED=0 $(GO) build -ldflags "-s -w -X $(PKG_VERSION).Version=$(VERSION) -X $(PKG_VERSION).Revision=$(REVISION)"
12+
313
bin/containerd-fuse-overlayfs-grpc:
4-
go build -o $@ ./cmd/containerd-fuse-overlayfs-grpc
14+
$(GO_BUILD) -o $@ $(PKG_MAIN)
515

616
install:
717
install bin/containerd-fuse-overlayfs-grpc $(DESTDIR)/bin
@@ -21,4 +31,19 @@ test:
2131
_test:
2232
go test -exec rootlesskit -test.v -test.root
2333

24-
.PHONY: bin/containerd-fuse-overlayfs-grpc install uninstall clean test _test
34+
TAR_FLAGS=--transform 's/.*\///g' --owner=0 --group=0
35+
36+
artifacts: clean
37+
mkdir -p _output
38+
GOOS=linux GOARCH=amd64 make
39+
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-amd64.tar.gz bin/*
40+
GOOS=linux GOARCH=arm64 make
41+
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-arm64.tar.gz bin/*
42+
GOOS=linux GOARCH=arm GOARM=7 make
43+
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-arm-v7.tar.gz bin/*
44+
GOOS=linux GOARCH=ppc64le make
45+
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-ppc64le.tar.gz bin/*
46+
GOOS=linux GOARCH=s390x make
47+
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-s390x.tar.gz bin/*
48+
49+
.PHONY: bin/containerd-fuse-overlayfs-grpc install uninstall clean test _test artifacts

cmd/containerd-fuse-overlayfs-grpc/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ import (
2323
"path/filepath"
2424

2525
sddaemon "github.com/coreos/go-systemd/v22/daemon"
26+
"github.com/sirupsen/logrus"
2627
"google.golang.org/grpc"
2728

2829
snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
2930
"github.com/containerd/containerd/contrib/snapshotservice"
3031

3132
fuseoverlayfs "github.com/AkihiroSuda/containerd-fuse-overlayfs"
33+
"github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc/version"
3234
)
3335

3436
// main is from https://github.com/containerd/containerd/blob/b9fad5e310fafb453def5f1e7094f4c36a9806d2/PLUGINS.md
3537
func main() {
38+
logrus.Infof("containerd-fuse-overlayfs-grpc Version=%q Revision=%q", version.Version, version.Revision)
3639
// Provide a unix address to listen to, this will be the `address`
3740
// in the `proxy_plugin` configuration.
3841
// The root will be used to store the snapshots.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package version
18+
19+
// Version and Revision are filled in Makefile
20+
var (
21+
Version = "<unknown>"
22+
Revision = "<unknown>"
23+
)

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require (
77
github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7
88
github.com/coreos/go-systemd/v22 v22.1.0
99
github.com/pkg/errors v0.9.1
10+
github.com/sirupsen/logrus v1.7.0
1011
google.golang.org/grpc v1.30.0
1112
)
1213

0 commit comments

Comments
 (0)