Check for new releases and build Docker images #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check for new releases and build Docker images | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Every day at midnight | |
workflow_dispatch: | |
env: | |
REGISTRY: imbios | |
PLATFORMS: linux/amd64,linux/arm64 | |
VERSIONS: 16,18,20 | |
TYPES: alpine,debian-slim,debian | |
nodejs-is-out-of-date: false | |
bun-is-out-of-date: false | |
jobs: | |
check-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Check for new releases in nodejs/node | |
id: nodejs | |
run: ./check-new-release.sh nodejs/node nodejs | |
- name: Check for new releases in oven-sh/bun | |
id: bun | |
run: ./check-new-release.sh oven-sh/bun bun | |
- name: Setup Docker Buildx | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
run: ./build-all.sh | |
env: | |
REGISTRY: ${{ env.REGISTRY }} | |
PLATFORMS: ${{ env.PLATFORMS }} | |
VERSIONS: ${{ env.VERSIONS }} | |
TYPES: ${{ env.TYPES }} | |
- name: Commit changes | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add last_bun.txt last_nodejs.txt | |
git diff-index --quiet HEAD || git commit -m "build: update versions" | |
- name: Pull changes | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
run: git pull -r | |
- name: Push changes | |
if: env.nodejs-is-out-of-date == 'true' || env.bun-is-out-of-date == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |