Skip to content

Commit

Permalink
Optimize GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kjarosh committed Feb 1, 2024
1 parent 58c48bf commit a10c22a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: |
make test
push:
needs: test
docker:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
Expand All @@ -34,52 +25,55 @@ jobs:
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
IMAGE_NAME=${{ github.actor }}/latex
echo VERSION=$VERSION
echo "version=${VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo IMAGE_ID=IMAGE_ID
IMAGE_ID=${{ github.actor }}/latex
echo IMAGE_ID=$IMAGE_ID
echo "IMAGE_ID=${IMAGE_ID}" >> $GITHUB_ENV
- name: Build minimal
run: |
make minimal
docker tag ${{ env.IMAGE_ID }}:latest-minimal ${{ env.IMAGE_ID }}:${{ env.version }}-minimal
docker tag ${{ env.IMAGE_ID }}:latest-minimal ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}-minimal
docker tag ${{ env.IMAGE_ID }}:latest-minimal ${{ env.IMAGE_ID }}:${{ env.VERSION }}-minimal
docker tag ${{ env.IMAGE_ID }}:latest-minimal ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}-minimal
- name: Build basic
run: |
make basic
docker tag ${{ env.IMAGE_ID }}:latest-basic ${{ env.IMAGE_ID }}:${{ env.version }}-basic
docker tag ${{ env.IMAGE_ID }}:latest-basic ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}-basic
docker tag ${{ env.IMAGE_ID }}:latest-basic ${{ env.IMAGE_ID }}:${{ env.VERSION }}-basic
docker tag ${{ env.IMAGE_ID }}:latest-basic ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}-basic
- name: Build small
run: |
make small
docker tag ${{ env.IMAGE_ID }}:latest-small ${{ env.IMAGE_ID }}:${{ env.version }}-small
docker tag ${{ env.IMAGE_ID }}:latest-small ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}-small
docker tag ${{ env.IMAGE_ID }}:latest-small ${{ env.IMAGE_ID }}:${{ env.VERSION }}-small
docker tag ${{ env.IMAGE_ID }}:latest-small ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}-small
- name: Build medium
run: |
make medium
docker tag ${{ env.IMAGE_ID }}:latest-medium ${{ env.IMAGE_ID }}:${{ env.version }}-medium
docker tag ${{ env.IMAGE_ID }}:latest-medium ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}-medium
docker tag ${{ env.IMAGE_ID }}:latest-medium ${{ env.IMAGE_ID }}:${{ env.VERSION }}-medium
docker tag ${{ env.IMAGE_ID }}:latest-medium ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}-medium
- name: Build full
run: |
make full
docker tag ${{ env.IMAGE_ID }}:latest-full ${{ env.IMAGE_ID }}:${{ env.version }}-full
docker tag ${{ env.IMAGE_ID }}:latest-full ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}-full
docker tag ${{ env.IMAGE_ID }}:latest-full ${{ env.IMAGE_ID }}:${{ env.version }}
docker tag ${{ env.IMAGE_ID }}:latest-full ghcr.io/${{ env.IMAGE_ID }}:${{ env.version }}
docker tag ${{ env.IMAGE_ID }}:latest-full ${{ env.IMAGE_ID }}:${{ env.VERSION }}-full
docker tag ${{ env.IMAGE_ID }}:latest-full ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}-full
docker tag ${{ env.IMAGE_ID }}:latest-full ${{ env.IMAGE_ID }}:${{ env.VERSION }}
docker tag ${{ env.IMAGE_ID }}:latest-full ghcr.io/${{ env.IMAGE_ID }}:${{ env.VERSION }}
- name: Run tests
run: |
make test
- name: Login to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand All @@ -88,15 +82,15 @@ jobs:

- name: Push images
run: |
docker push ${{ env.image_name }}:${{ env.version }}-minimal
docker push ${{ env.image_name }}:${{ env.version }}-basic
docker push ${{ env.image_name }}:${{ env.version }}-small
docker push ${{ env.image_name }}:${{ env.version }}-medium
docker push ${{ env.image_name }}:${{ env.version }}-full
docker push ${{ env.image_name }}:${{ env.version }}
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}-minimal
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}-basic
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}-small
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}-medium
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}-full
docker push ghcr.io/${{ env.image_name }}:${{ env.version }}
docker push ${{ env.image_name }}:${{ env.VERSION }}-minimal
docker push ${{ env.image_name }}:${{ env.VERSION }}-basic
docker push ${{ env.image_name }}:${{ env.VERSION }}-small
docker push ${{ env.image_name }}:${{ env.VERSION }}-medium
docker push ${{ env.image_name }}:${{ env.VERSION }}-full
docker push ${{ env.image_name }}:${{ env.VERSION }}
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}-minimal
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}-basic
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}-small
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}-medium
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}-full
docker push ghcr.io/${{ env.image_name }}:${{ env.VERSION }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LaTeX in Docker

![GitHub license](https://img.shields.io/github/license/kjarosh/latex-docker)
![GitHub build status](https://img.shields.io/github/actions/workflow/status/kjarosh/latex-docker/docker-publish.yml?branch=main)
![GitHub build status](https://img.shields.io/github/actions/workflow/status/kjarosh/latex-docker/docker.yml?branch=main)
[![GitHub release](https://img.shields.io/github/v/release/kjarosh/latex-docker)](https://github.com/kjarosh/latex-docker/releases)
[![DockerHub](https://img.shields.io/badge/docker.io-kjarosh%2Flatex-blue)](https://hub.docker.com/r/kjarosh/latex)
[![GitHub Container Registry](https://img.shields.io/badge/ghcr.io-kjarosh%2Flatex-blue)](https://github.com/users/kjarosh/packages/container/package/latex)
Expand Down

0 comments on commit a10c22a

Please sign in to comment.