Skip to content

Commit 13c3102

Browse files
authored
Merge pull request #8 from Nebell/soc
[SoC] Go-wechaty Github Actions Optimization
2 parents 9ceb2b3 + 6658b22 commit 13c3102

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

.github/workflows/extra.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
name: Update Dependencies
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
repository_dispatch:
8+
types: [ updatedeps ]
9+
10+
jobs:
11+
UpdateDep:
12+
name: Update Dependency
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Go environment
19+
uses: actions/[email protected]
20+
with:
21+
go-version: 1.14.4 # optional
22+
- name: Update Dependency
23+
run: go get -u ./...
24+
25+
- name: Test
26+
run: |
27+
make install
28+
make test
29+
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v2
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
commit-message: Update dependencies
35+
title: Update dependencies
36+
body: |
37+
- Dependency updates
38+
39+
Auto-generated by [create-pull-request][1]
40+
41+
[1]: https://github.com/peter-evans/create-pull-request
42+
branch: update-dependencies

.github/workflows/go.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,21 @@ jobs:
2929

3030
- name: Go Test
3131
run: make test
32+
33+
push:
34+
name: Push Docker image to Github Packages
35+
runs-on: ubuntu-latest
36+
needs: build
37+
if: github.event_name != 'pull_request'
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
42+
- name: Build and push Docker images
43+
uses: docker/[email protected]
44+
with:
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
registry: docker.pkg.github.com
48+
repository: wechaty/go-wechaty-getting-started/dingdongbot
49+
tag_with_ref: true

.github/workflows/win.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test on Windows
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
Build:
11+
name: Build on Windows
12+
runs-on: windows-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Go environment
19+
uses: actions/[email protected]
20+
with:
21+
go-version: 1.14.4 # optional
22+
23+
- name: Build Dingdongbot
24+
run: |
25+
go vet ./...
26+
make install
27+
make test

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM golang AS builder
2+
WORKDIR /root/
3+
COPY . src
4+
ENV GOPROXY https://goproxy.io,direct
5+
RUN cd src && CGO_ENABLED=0 GOOS=linux go build -o ding-dong-bot -v ./examples/ding-dong-bot.go
6+
7+
FROM alpine AS prod
8+
WORKDIR /root/
9+
COPY --from=builder /root/src/ding-dong-bot .
10+
ENTRYPOINT ["./ding-dong-bot"]

0 commit comments

Comments
 (0)