DEV Community

Mark Tse
Mark Tse

Posted on • Updated on

Using GitHub Actions to Keep Another GitHub Action's Image Up-to-Date

My Workflow

gh-action-node-update-deps is a GitHub action for keeping dependencies up-to-date. Each time it runs, it installs the latest version of a few dependencies (Git, curl, hub). To improve performance, I created a custom Docker image with these dependencies already installed.

To keep this Docker image and all the installed dependencies up-to-date, I created a GitHub Actions workflow to schedule a recurring build of this image, which use a cron trigger and:

Submission Category:

DIY Deployments

Yaml File or Link to Code

name: Publish to Docker

on:
  schedule:
    - cron:  '0 * * * *'
  workflow_dispatch:

jobs:
  publish-to-docker:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - run: |
        git config user.name github-actions[bot]
        git config user.email 41898282+github-actions[bot]@users.noreply.github.com
        git commit --allow-empty -m "chore: update image (automated)."
        git push
    - uses: docker/build-push-action@v1
      with:
        username: neverendingqs
        password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
        repository: ${{ env.GITHUB_REPOSITORY }}
        add_git_labels: true
        tag_with_ref: true
        tag_with_sha: true

Additional Resources / Info

Top comments (0)