Skip to content

Commit

Permalink
Merge pull request #8 from Nebell/soc
Browse files Browse the repository at this point in the history
[SoC] Go-wechaty Github Actions Optimization
  • Loading branch information
dingdayu committed Sep 15, 2020
2 parents 9ceb2b3 + 6658b22 commit 13c3102
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/extra.yml
@@ -0,0 +1,42 @@

name: Update Dependencies

on:
push:
branches: [ master ]
repository_dispatch:
types: [ updatedeps ]

jobs:
UpdateDep:
name: Update Dependency
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go environment
uses: actions/setup-go@v2.1.0
with:
go-version: 1.14.4 # optional
- name: Update Dependency
run: go get -u ./...

- name: Test
run: |
make install
make test
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update dependencies
title: Update dependencies
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-dependencies
18 changes: 18 additions & 0 deletions .github/workflows/go.yml
Expand Up @@ -29,3 +29,21 @@ jobs:

- name: Go Test
run: make test

push:
name: Push Docker image to Github Packages
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and push Docker images
uses: docker/build-push-action@v1.1.0
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: wechaty/go-wechaty-getting-started/dingdongbot
tag_with_ref: true
27 changes: 27 additions & 0 deletions .github/workflows/win.yml
@@ -0,0 +1,27 @@
name: Test on Windows

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
Build:
name: Build on Windows
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go environment
uses: actions/setup-go@v2.1.0
with:
go-version: 1.14.4 # optional

- name: Build Dingdongbot
run: |
go vet ./...
make install
make test
10 changes: 10 additions & 0 deletions Dockerfile
@@ -0,0 +1,10 @@
FROM golang AS builder
WORKDIR /root/
COPY . src
ENV GOPROXY https://goproxy.io,direct
RUN cd src && CGO_ENABLED=0 GOOS=linux go build -o ding-dong-bot -v ./examples/ding-dong-bot.go

FROM alpine AS prod
WORKDIR /root/
COPY --from=builder /root/src/ding-dong-bot .
ENTRYPOINT ["./ding-dong-bot"]

0 comments on commit 13c3102

Please sign in to comment.