Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add gha caching for dev images #24

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

env:
IMAGE_NAME: librephotos

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
Expand All @@ -25,39 +25,41 @@ jobs:

- name: Run tests
run: echo "To-Do Add Running Tests"

build:
name: Building dev build
# Ensure test job passes before pushing image.
if: github.event_name != 'release'
needs: test

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./backend
platforms: linux/amd64,linux/arm64
push: true
tags: reallibrephotos/librephotos:dev

cache-from: type=gha
cache-to: type=gha,mode=max

release-job:
name: Releasing
if: github.event_name == 'release' && github.event.action == 'created'
Expand All @@ -68,19 +70,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [created]
repository_dispatch:
types: frontend-commit-event

push:
# Publish `dev` as Docker `latest` image.
branches:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Run tests
run: echo "To-Do Add Tests"

build:
if: github.event_name != 'release'
# Ensure test job passes before pushing image.
Expand All @@ -45,27 +45,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./frontend
platforms: linux/amd64,linux/arm64
push: true
tags: reallibrephotos/librephotos-frontend:dev

cache-from: type=gha
cache-to: type=gha,mode=max

release-job:
name: Releasing
if: github.event_name == 'release' && github.event.action == 'created'
Expand All @@ -77,19 +79,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main
paths:
- 'proxy/**'

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
Expand All @@ -21,7 +21,7 @@ jobs:

- name: Run tests
run: echo "To-Do Add Tests"

build:
if: github.event_name != 'release'
# Ensure test job passes before pushing image.
Expand All @@ -32,27 +32,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./proxy
platforms: linux/amd64,linux/arm64
push: true
tags: reallibrephotos/librephotos-proxy:dev

cache-from: type=gha
cache-to: type=gha,mode=max

release-job:
name: Releasing
if: github.event_name == 'release' && github.event.action == 'created'
Expand All @@ -64,19 +66,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down