-
Notifications
You must be signed in to change notification settings - Fork 66
46 lines (38 loc) · 1.2 KB
/
go-write-to-file.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
name: go-write-to-file
on:
workflow_dispatch:
schedule:
- cron: '30 05,13,20 * * *'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# Using v4 to use in-built caching
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: '1.20'
id: go
# Using modules to maintain the dependencies, and download them only when there is a cache-miss
- name: Get dependencies
if: steps.go.outputs.cache-hit != 'true'
run: go mod tidy
- name: Build
run: cd backend && go build -v -o main-to-file main-to-file.go
- run: cd backend && ./main-to-file -gh_token=${{secrets.TOKEN}}
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time
- name: push to repo
env:
TIME: '${{ steps.current-time.outputs.time }}'
run: |
git pull
git config user.name darensin01
git config user.email [email protected]
git add backend/data.json
git commit -m "$TIME: new data pushed"
git push