|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: Update Dependencies and Test on Windows |
| 4 | + |
| 5 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 6 | +# events but only for the master branch |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [ master ] |
| 10 | + pull_request: |
| 11 | + branches: [ master ] |
| 12 | + |
| 13 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 14 | +jobs: |
| 15 | + UpdateDep: |
| 16 | + name: Update Dependency |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Setup Go environment |
| 23 | + |
| 24 | + with: |
| 25 | + # The Go version to download (if necessary) and use. Supports semver spec and ranges. |
| 26 | + go-version: 1.14.4 # optional |
| 27 | + - name: Update Dependency |
| 28 | + env: |
| 29 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + run: | |
| 31 | + mv go.mod go.mod.bak |
| 32 | + go mod init github.com/wechaty/go-wechaty-getting-started |
| 33 | + go mod tidy |
| 34 | +
|
| 35 | + - name: Verify Defference |
| 36 | + run: | |
| 37 | + echo "Verifying" |
| 38 | + if [ $(md5sum go.mod | cut -d " " -f1) != $(md5sum go.mod.bak | cut -d " " -f1) ] |
| 39 | + then |
| 40 | + git checkout -b update-dependencies |
| 41 | + git add go.mod |
| 42 | + git commit -m "update-dependencies commit" |
| 43 | + echo "Updated" |
| 44 | + else |
| 45 | + echo "Have been updated" |
| 46 | + fi |
| 47 | + rm -f go.mod.bak |
| 48 | + - name: Create Pull Request |
| 49 | + uses: peter-evans/create-pull-request@v2 |
| 50 | + with: |
| 51 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + commit-message: Update dependencies |
| 53 | + title: Update dependencies |
| 54 | + body: | |
| 55 | + - Dependency updates |
| 56 | +
|
| 57 | + Auto-generated by [create-pull-request][1] |
| 58 | +
|
| 59 | + [1]: https://github.com/peter-evans/create-pull-request |
| 60 | + branch: update-dependencies |
| 61 | + |
| 62 | + |
| 63 | + Build: |
| 64 | + name: Build on Windows |
| 65 | + needs: UpdateDep |
| 66 | + # The type of runner that the job will run on |
| 67 | + runs-on: windows-latest |
| 68 | + |
| 69 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 70 | + steps: |
| 71 | + - name: Checkout |
| 72 | + uses: actions/checkout@v2 |
| 73 | + |
| 74 | + - name: Setup Go environment |
| 75 | + |
| 76 | + with: |
| 77 | + # The Go version to download (if necessary) and use. Supports semver spec and ranges. |
| 78 | + go-version: 1.14.4 # optional |
| 79 | + |
| 80 | + # Runs a single command using the runners shell |
| 81 | + - name: Build Dingdongbot |
| 82 | + run: go build examples/dingdongbot.go |
0 commit comments