Skip to content

Update Docker Images #912

Update Docker Images

Update Docker Images #912

name: Update Docker Images
on:
workflow_dispatch:
schedule:
- cron: "50 6 * * 0-6"
push:
tags:
- "*.*.*"
branches:
- "release/*"
- "main"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
AWS_REGION: us-east-1
jobs:
frontend-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
backend-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.3"
- run: go test --count 1 ./backend/...
# Run tests again with the race-detector.
# Using the same job to reuse the build cache.
- run: go test --count 1 -race ./backend/...
generate-docker-images:
runs-on: ubuntu-latest
needs: [frontend-tests, backend-tests]
steps:
- name: Force Install GIT latest
run: |
sudo apt-get install -y software-properties-common \
&& sudo apt-get update \
&& sudo add-apt-repository -y ppa:git-core/ppa \
&& sudo apt-get update \
&& sudo apt-get install -y git \
&& git --version
- name: Checkout code
uses: actions/checkout@v4
- name: Get commit date for the triggering commit
run: |
COMMIT_DATE=$(git show -s --format="%cd" ${{ github.sha }})
echo "COMMIT_DATE=$COMMIT_DATE" >> $GITHUB_ENV
# Checkout the repository to the GitHub Actions runner
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Check release tag
id: release-tag
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: 'refs/tags/[0-9]{4}\.[0-9]+\.[0-9]+$'
- name: Check release candidate tag
id: release-candidate-tag
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.ref }}
regex: 'refs/tags/[0-9]{4}\.[0-9]+\.[0-9]+-rc[0-9]+$'
- name: Build and push edge seedhypermedia/web:dev
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: frontend/apps/web/Dockerfile
tags: seedhypermedia/web:dev
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SITE_SENTRY_DSN=${{ secrets.SITE_SENTRY_DSN }}
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
- name: Build and push stable seedhypermedia/web:latest
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: frontend/apps/web/Dockerfile
tags: seedhypermedia/web:latest
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SITE_SENTRY_DSN=${{ secrets.SITE_SENTRY_DSN }}
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
- name: Build and push edge seedhypermedia/site:dev
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
file: backend/cmd/seed-daemon/Dockerfile
tags: seedhypermedia/site:dev
- name: Build and push stable seedhypermedia/site:latest
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}
BRANCH=${{ github.ref }}
DATE=${{ env.COMMIT_DATE }}
file: backend/cmd/seed-daemon/Dockerfile
tags: seedhypermedia/site:latest
- name: Build and push edge monitord
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: seedhypermedia/monitord:dev
- name: Build and push rc monitord
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: seedhypermedia/monitord:rc
- name: Build and push stable monitord
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/monitord/Dockerfile
tags: seedhypermedia/monitord:latest
- name: Build and push edge relay
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: seedhypermedia/relayd:dev
- name: Build and push rc relay
if: (startsWith(github.ref, 'refs/tags/') && (steps.release-candidate-tag.outputs.match || steps.release-tag.outputs.match)) || startsWith(github.ref, 'refs/heads/release/')
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: seedhypermedia/relayd:rc
- name: Build and push stable relay
if: startsWith(github.ref, 'refs/tags/') && steps.release-tag.outputs.match
uses: docker/build-push-action@v4
with:
push: true
file: backend/cmd/relayd/Dockerfile
tags: seedhypermedia/relayd:latest