Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from AkihiroSuda/dev-ci
Browse files Browse the repository at this point in the history
add .github/workflows/release.yml
  • Loading branch information
AkihiroSuda authored Jan 18, 2021
2 parents e073746 + 4f86ed6 commit 98d5f30
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release
on:
push:
tags:
- 'v*'
- 'test-action-release-*'
env:
GO111MODULE: on
jobs:
release:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
- uses: actions/checkout@v2
- name: "Compile binaries"
run: make artifacts
- name: "SHA256SUMS"
run: |
( cd _artifacts; sha256sum cni-isolation-* ) | tee /tmp/SHA256SUMS
mv /tmp/SHA256SUMS _artifacts/SHA256SUMS
- name: "The sha256sum of the SHA256SUMS file"
run: (cd _artifacts; sha256sum SHA256SUMS)
- name: "Prepare the release note"
run: |
tag="${GITHUB_REF##*/}"
shasha=$(sha256sum _artifacts/SHA256SUMS | awk '{print $1}')
cat << EOF | tee /tmp/release-note.txt
${tag}
#### Changes
(To be documented)
#### About the binaries
The binaries were built automatically on GitHub Actions.
The build log is available for 90 days: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
The sha256sum of the SHA256SUMS file itself is \`${shasha}\` .
EOF
- name: "Create release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF##*/}"
asset_flags=()
for f in _artifacts/*; do asset_flags+=("-a" "$f"); done
hub release create "${asset_flags[@]}" -F /tmp/release-note.txt --draft "${tag}"
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ jobs:
version: v1.35
args: --verbose

cross:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.15.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: "Cross"
run: make artifacts

test:
runs-on: ubuntu-20.04
timeout-minutes: 20
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/bin
*.test
_artifacts
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ bin/isolation:
mkdir -p bin
$(GO_BUILD) -o bin/isolation ./plugins/meta/isolation

# arch: https://github.com/containernetworking/plugins/blob/e13bab99e54b4a34375450518d7db7a3da825e44/scripts/release.sh#L24
artifacts:
make clean
mkdir _artifacts
for arch in amd64 arm arm64 ppc64le s390x mips64le; do \
GOARCH=$$arch make ; \
tar czvf _artifacts/cni-isolation-$${arch}.tgz --owner=0 --group=0 -C bin isolation ; \
rm -rf bin ; \
done

clean:
rm -rf bin
rm -rf bin _artifacts

.PHONY: binary install uninstall bin/isolation clean
.PHONY: binary install uninstall bin/isolation artifacts clean

0 comments on commit 98d5f30

Please sign in to comment.