Skip to content

Commit 1ba2205

Browse files
authored
Remove upload-artifacts (#56)
1 parent 7b6f189 commit 1ba2205

File tree

2 files changed

+66
-82
lines changed

2 files changed

+66
-82
lines changed

.github/workflows/main.yaml

Lines changed: 18 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,92 +4,28 @@ on:
44
push:
55
branches:
66
- 'main'
7-
tags:
8-
- 'v*'
7+
env:
8+
go-version: 1.16
99
jobs:
1010
build:
11-
name: Build binaries
11+
name: Build
1212
runs-on: ubuntu-20.04
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-go@v2
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Setup golang
18+
uses: actions/setup-go@v2
1619
with:
17-
go-version: 1.16
18-
- run: make test
19-
- run: make install GOBIN=/tmp/
20-
- name: Upload binaries for setup-hw
21-
uses: actions/upload-artifact@v2
22-
with:
23-
name: setup-hw-binaries
24-
path: |
25-
/tmp/setup-hw
26-
/tmp/monitor-hw
27-
/tmp/collector
28-
/tmp/setup-apply-firmware
29-
retention-days: 1
30-
build_image:
31-
name: Build images
32-
needs: build
33-
runs-on: ubuntu-20.04
34-
steps:
35-
- uses: actions/checkout@v2
36-
- name: Download binaries for setup-hw
37-
uses: actions/download-artifact@v2
38-
with:
39-
name: setup-hw-binaries
40-
- run: |
41-
cp setup-hw docker
42-
cp monitor-hw docker
43-
cp collector docker
44-
cp setup-apply-firmware docker
45-
- run: |
20+
go-version: ${{ env.go-version }}
21+
22+
- name: Run test
23+
run: make test
24+
25+
- name: Build binaries
26+
run: make install GOBIN=`pwd`/docker
27+
28+
- name: Build setup-hw image
29+
run: |
4630
docker build -t quay.io/cybozu/setup-hw:latest --target stage1 docker
4731
docker build -t quay.io/cybozu/setup-hw-secret:latest docker
48-
- run: |
49-
mkdir -p /tmp/docker
50-
docker save quay.io/cybozu/setup-hw:latest -o /tmp/docker/setup-hw-image
51-
docker save quay.io/cybozu/setup-hw-secret:latest -o /tmp/docker/setup-hw-secret-image
52-
- name: Upload setup-hw images
53-
uses: actions/upload-artifact@v2
54-
with:
55-
name: setup-hw-images
56-
path: |
57-
/tmp/docker/setup-hw-image
58-
/tmp/docker/setup-hw-secret-image
59-
retention-days: 1
60-
release:
61-
name: Release on GitHub
62-
runs-on: ubuntu-20.04
63-
needs: build_image
64-
if: startsWith(github.ref, 'refs/tags/v')
65-
steps:
66-
- name: Download setup-hw images
67-
uses: actions/download-artifact@v2
68-
with:
69-
name: setup-hw-images
70-
- name: Load images
71-
run: |
72-
docker load -i setup-hw-image
73-
docker load -i setup-hw-secret-image
74-
- name: Push images
75-
run: |
76-
echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USER }} --password-stdin quay.io
77-
TAG=${GITHUB_REF#refs/tags/v}
78-
for name in setup-hw setup-hw-secret; do
79-
echo "pushing ${name}:v${TAG} ..."
80-
docker tag quay.io/cybozu/${name}:latest quay.io/cybozu/${name}:$TAG
81-
docker push quay.io/cybozu/${name}:latest
82-
docker push quay.io/cybozu/${name}:$TAG
83-
done
84-
- name: Create release
85-
id: create_release
86-
uses: actions/create-release@v1
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
with:
90-
tag_name: ${{ github.ref }}
91-
release_name: Release ${{ github.ref }}
92-
body: |
93-
See [CHANGELOG.md](./CHANGELOG.md) for details.
94-
draft: false
95-
prerelease: ${{ contains(github.ref, '-') }}

.github/workflows/release.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
env:
7+
go-version: 1.16
8+
jobs:
9+
build:
10+
name: Release
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Setup golang
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ env.go-version }}
20+
21+
- name: Build binaries
22+
run: make install GOBIN=`pwd`/docker
23+
24+
- name: Build setup-hw image
25+
run: |
26+
docker build -t quay.io/cybozu/setup-hw:latest --target stage1 docker
27+
docker build -t quay.io/cybozu/setup-hw-secret:latest docker
28+
29+
- name: Push images
30+
run: |
31+
echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USER }} --password-stdin quay.io
32+
tag=${GITHUB_REF#refs/tags/v}
33+
for name in setup-hw setup-hw-secret; do
34+
echo "pushing ${name}:v${tag} ..."
35+
docker tag quay.io/cybozu/${name}:latest quay.io/cybozu/${name}:$tag
36+
if ! echo $tag | grep -q -e '-'; then docker push quay.io/cybozu/${name}:latest; fi
37+
docker push quay.io/cybozu/${name}:$tag
38+
done
39+
40+
- name: Create release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
tagname="${GITHUB_REF#refs/tags/}"
45+
if echo ${{ github.ref }} | grep -q -e '-'; then prerelease=-p; fi
46+
gh release create -t "Release $tagname" $prerelease \
47+
-n "See [CHANGELOG.md](./CHANGELOG.md) for details." \
48+
"$tagname"

0 commit comments

Comments
 (0)