diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..21b422d --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,21 @@ +name: Readme Update Blog +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + update-blog: + name: Update latest blogs + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Fetch medium.com posts + uses: ./ + with: + rss_list: "https://imskr.medium.com/feed" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9f35bea..0e37eb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,21 @@ -FROM golang:1.18-alpine +FROM ubuntu:latest -RUN apk add -q --update \ - && apk add -q \ - bash \ - git \ - curl \ - && rm -rf /var/cache/apk/* +RUN apt-get update +RUN apt-get install -y wget git gcc bash -# Copy all the files from the host into the container -WORKDIR /src -COPY . . +RUN wget -P /tmp https://dl.google.com/go/go1.18.linux-amd64.tar.gz -# Enable Go modules -ENV GO111MODULE=on +RUN tar -C /usr/local -xzf /tmp/go1.18.linux-amd64.tar.gz +RUN rm /tmp/go1.18.linux-amd64.tar.gz -# Compile the action -RUN go build -o /bin/action +ENV GOPATH /go +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" -# Specify the container's entrypoint as the action -ENTRYPOINT ["/bin/action"] +RUN go version + +WORKDIR /app +COPY . /app/ + +# Start app +ENTRYPOINT ["go", "run", "/app/main.go"] \ No newline at end of file diff --git a/action.yml b/action.yml index f9e27e0..829bc11 100644 --- a/action.yml +++ b/action.yml @@ -31,18 +31,24 @@ outputs: description: "Stringified posts in readme format" runs: - using: "composite" - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 - with: - go-version: '1.18' + using: "docker" + image: "Dockerfile" + args: + - "-rss_list=${{ inputs.rss_list }}" + - "-commit_user=${{ inputs.commit_user }}" + - "-commit_email=${{ inputs.commit_email }}" + - "-commit_message=${{ inputs.commit_message }}" + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-go@v2 + # with: + # go-version: '1.18' - - run: go mod tidy - shell: bash + # - run: go mod tidy + # shell: bash - - run: go run ${{ github.action_path }}/main.go - shell: bash + # - run: go run ${{ github.action_path }}/main.go + # shell: bash branding: icon: 'file-text'