Consolidate and optimize steps.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-11-18 12:33:28 -06:00
parent d107f1009c
commit 1588257f06
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
1 changed files with 5 additions and 58 deletions

View File

@ -21,7 +21,7 @@ on:
jobs:
build:
name: Build and Test
name: Build, Test and Publish
runs-on: ubuntu-latest
env:
APPLICATION_ENV: testing
@ -118,7 +118,6 @@ jobs:
load: true
tags: ghcr.io/azuracast/web:latest
cache-from: type=registry,ref=ghcr.io/azuracast/web:buildcache
outputs: type=docker,dest=/tmp/azuracast_web.tar
- name: Set up functional test environment.
run: |
@ -144,69 +143,16 @@ jobs:
docker-compose logs
cat tests/_output/*
- name: Upload built static assets and translations
uses: actions/upload-artifact@v2
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
name: assets
if-no-files-found: error
path: |
resources/locale/compiled
resources/locale/translations.json
web/static/dist
web/static/webpack_dist
web/static/webpack.json
web/static/assets.json
web/static/api/openapi.yml
- name: Upload Docker image as artifact
uses: actions/upload-artifact@v2
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
name: myimage
path: /tmp/azuracast_web.tar
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'schedule'
steps:
- uses: actions/checkout@master
- name: Reduce Git repository size.
run: |
git gc --prune=now --aggressive
- name: Download built static assets from previous step
uses: actions/download-artifact@v2
with:
name: assets
# - name : Set up QEMU
# uses : docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Download artifact from previous step
uses: actions/download-artifact@v2
with:
name: myimage
path: /tmp
- name: Load image from previous step
run: |
docker load --input /tmp/azuracast_web.tar
docker image ls -a
- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -215,6 +161,7 @@ jobs:
- name: Build Docker Metadata
id: meta
uses: crazy-max/ghaction-docker-meta@v2
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
images: |
azuracast/azuracast_web_v2
@ -226,10 +173,10 @@ jobs:
- name: Publish Web Image
uses: docker/build-push-action@master
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/azuracast/web:latest
cache-to: type=registry,ref=ghcr.io/azuracast/web:buildcache,mode=max