diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a835f70 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +201* +2020 +docs +.github +.jekyll \ No newline at end of file diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..5751389 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,16 @@ +# Workflow for dyweb weekly + +GitHub workflow does the following things + +- create a new issue every week +- close old issues when creating new issues +- generate new weekly markdown file and push to master +- generate new html? (not sure if it is really needed) + +## TODO + +- multiple workflow yaml + +## Reference + +- [cron](https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) \ No newline at end of file diff --git a/.github/workflows/issue.yaml b/.github/workflows/issue.yaml new file mode 100644 index 0000000..7e2d33d --- /dev/null +++ b/.github/workflows/issue.yaml @@ -0,0 +1,16 @@ +# create a new issue every week +# FIXME(at15): it is coded to every 5 minutes to have test if things are working + +on: + schedule: + - cron: '*/5 * * * *' + +job: + create: + runs-on: ubuntu-latest + name: create new weekly issue + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: new issue + uses: ./ # Uses action in the root directory \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0b6fd92 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# https://steele.blue/tiny-github-actions/ +FROM dyweb/go-dev:1.13.6 as builder + +LABEL maintainer="contact@dongyue.io" + +ARG PROJECT_ROOT=/go/src/github.com/dyweb/weekly + +WORKDIR $PROJECT_ROOT + +COPY . $PROJECT_ROOT +RUN cd scripts/weekly && go install . + +FROM ubuntu:18.04 +LABEL maintainer="contact@dongyue.io" +WORKDIR /usr/bin +COPY --from=builder /go/bin/weekly . +ENTRYPOINT ["weekly"] +CMD ["help"] \ No newline at end of file diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d39be80 --- /dev/null +++ b/action.yml @@ -0,0 +1,8 @@ +name: 'weekly' +description: 'Create new weekly issue, run weekly generator' +runs: + using: 'docker' + image: 'Dockerfile' + # TODO: allow passing arguments from workflow + args: + - foo \ No newline at end of file diff --git a/scripts/weekly/go.mod b/scripts/weekly/go.mod new file mode 100644 index 0000000..2aa38bc --- /dev/null +++ b/scripts/weekly/go.mod @@ -0,0 +1,3 @@ +module github.com/dyweb/weekly/scripts/weekly + +go 1.13 diff --git a/scripts/weekly/main.go b/scripts/weekly/main.go new file mode 100644 index 0000000..9cdc29a --- /dev/null +++ b/scripts/weekly/main.go @@ -0,0 +1,12 @@ +package main + +import ( + "fmt" + "os" +) + +// TODO: create github client, port code from https://github.com/dyweb/dy-bot/blob/master/pkg/weekly/worker.go + +func main() { + fmt.Printf("weekly args %v\n", os.Args) +}