-
Notifications
You must be signed in to change notification settings - Fork 11
66 lines (53 loc) · 1.88 KB
/
upload-to-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
name: Go Release
on:
release:
types: [published]
jobs:
release:
if: github.repository == 'PasteUs/HelloCI'
name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }} and upload
runs-on: ${{ matrix.os }}
strategy:
matrix:
go_version: [1.13]
os: [ubuntu-latest]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
go build -v -o main .
- name: Gzip
run: |
mkdir hello-word-${{ matrix.os }}
cp main hello-word-${{ matrix.os }}
tar -czvf hello-word-${{ matrix.os }}.tar.gz hello-word-${{ matrix.os }}
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: hello-word-${{ matrix.os }}.tar.gz application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_PASSWORD }}
- name: Login Docker Registry
uses: elgohr/Publish-Docker-Github-Action@2.7
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-hangzhou.aliyuncs.com
- name: Publish Docker
run: |
export DOCKER_TAG=$(echo ${{ github.ref }} | awk -F'release-v' '{ print $2 }')
docker build -t registry.cn-hangzhou.aliyuncs.com/pasteus/hello-ci:${DOCKER_TAG} .
docker push registry.cn-hangzhou.aliyuncs.com/pasteus/hello-ci:${DOCKER_TAG}