mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
chore: remove unused build emulator workflow (#3737)
This commit is contained in:
109
.github/workflows/docker-emulator-build.yml
vendored
109
.github/workflows/docker-emulator-build.yml
vendored
@@ -1,109 +0,0 @@
|
||||
# Build docker container for development emulators
|
||||
# Uses github container registry for caching and additional push to dockerhub for public use
|
||||
|
||||
# Secrets required:
|
||||
# DOCKERHUB_USERNAME
|
||||
# DOCKERHUB_TOKEN
|
||||
|
||||
name: Docker Emulator Build
|
||||
on:
|
||||
# Run only when a pr has been merged into master and contains changes to seed data (additional check below for merge instead of close)
|
||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-when-a-pull-request-merges-1
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- master
|
||||
# Only create new build when seed data or functions update
|
||||
# Ignore src-only changes as will populate conflicting docker image tag
|
||||
paths:
|
||||
- 'packages/emulators-docker/seed_data/**'
|
||||
# Allow manual trigger of build in case of broken/minor updates
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# Image name that will be added as suffix to either github repo owner or dockerhub username
|
||||
IMAGE_NAME: community-platform-emulator
|
||||
jobs:
|
||||
build_and_preview:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Setup
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
# Login to github container registry and dockerhub
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
# Prepare image tags for future submission to both github container registry and dockerhub
|
||||
# Contains custom tagging strategy (currently prefix pp for precious-plastic and date)
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }},${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=2023-11-09c
|
||||
# TODO - would be nice to extract tags based on seed data provided automatically or consider other strategies
|
||||
# https://github.com/docker/metadata-action#tags-input
|
||||
flavor: |
|
||||
latest=auto
|
||||
prefix=pp-
|
||||
|
||||
# Prepare build
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||
- name: Setup Cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install npm dependencies
|
||||
run: yarn install --immutable
|
||||
- name: Set environment variables
|
||||
run: export REACT_APP_PROJECT_VERSION=${GITHUB_SHA}
|
||||
- name: Prepare Build
|
||||
run: yarn workspace oa-emulators-docker prepare
|
||||
# Populate the list of build args generated in the prepare script to local env as multi line string
|
||||
# https://docs.github.com/en/github-ae@latest/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
|
||||
- name: Set build args
|
||||
run: |
|
||||
BUILD_ARGS=$(cat packages/emulators-docker/build.args)
|
||||
echo "BUILD_ARGS<<EOF" >> $GITHUB_ENV
|
||||
echo "$BUILD_ARGS" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
# Build and deploy
|
||||
# This will use the tags generate to identify target destination, by default pushing to both
|
||||
# github container registery (used mostly for caching as requires gh auth to pull locally) and
|
||||
# dockerhub (used publicy)
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: packages/emulators-docker
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha, scope=${{ github.workflow }}
|
||||
cache-to: type=gha, scope=${{ github.workflow }}, mode=max
|
||||
# Ensure args pass as multiline string
|
||||
build-args: |
|
||||
${{ env.BUILD_ARGS }}
|
||||
Reference in New Issue
Block a user