Skip to content

Bug fix: Correctly glob Gradle build output when copying to root dir #252

Bug fix: Correctly glob Gradle build output when copying to root dir

Bug fix: Correctly glob Gradle build output when copying to root dir #252

Workflow file for this run

name: CI
# TODO Looks like workflows ARE reusable now: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Specify defaults for all jobs' `run` blocks.
# See:
# https://github.community/t/use-working-directory-for-entire-job/16747/9
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun
# https://github.community/t/github-actions-configure-defaults-option/18438/3
defaults:
run:
shell: bash
working-directory: ./
# Set GitHub user info for ease of use of `gh` CLI commands.
#
# See:
# - https://docs.npmjs.com/cli/v9/commands/npm-run-script#ignore-scripts
# - https://stackoverflow.com/questions/59471962/how-does-npm-behave-differently-with-ignore-scripts-set-to-true
# - https://github.com/tschaub/gh-pages#optionsuser
# - https://github.com/actions/checkout/issues/13
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gitUserName: ${{ github.actor }}
gitUserEmail: ${{ github.actor }}@users.noreply.github.com
nodeVersion: 18
clientVersion: ""
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Job 1. Handles everything related to the client/ folder
ci-client-verify:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Specify defaults for all runs/steps.
defaults:
run:
# Specify directory in which to run all subsequent steps/commands
#
# If using a monolith with `./client/` and `./server/` directories:
# working-directory: ./client
working-directory: ./client/
outputs:
CLIENT_CACHE_ID: ${{ env.CLIENT_CACHE_ID }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: CI:Client - Checkout repository branch
uses: actions/checkout@v3
- name: CI:Client - Set NodeJS version
uses: actions/setup-node@v3
with:
node-version: ${{ env.nodeVersion }}
- name: CI:Client - Run all
id: ci-client-all
# Import reusable GitHub Action logic via `uses`
uses: ./.github/workflows/actions/client
# Set env vars for all nested composite actions.
# Any env vars set within composite actions apply to the parent job.
#
# See:
# - https://github.com/orgs/community/discussions/27088
# - https://stackoverflow.com/questions/70098241/using-secrets-in-composite-actions-github/70111134#70111134
# - https://stackoverflow.com/questions/63663436/what-is-difference-between-with-and-env
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
gitUserName: ${{ env.gitUserName }}
gitUserEmail: ${{ env.gitUserEmail }}
nodeVersion: ${{ env.nodeVersion }}
with:
clientVersion: ${{ env.clientVersion }}
# Env vars are always accessible between jobs of the same workflow.
# - $CLIENT_CACHE_ID
# - ${{ env.CLIENT_CACHE_ID }}
# Adding an output var means we can reference the job ID in subsequent jobs:
# - ${{ needs.ci-client.outputs.CLIENT_CACHE_ID }}
# If a nested composite action forwards its child/(doubly-)nested composite action's outputs in its own
# root-level `outputs` block, then we can also reference the job's specific step in subsequent jobs:
# - ${{ needs.ci-client-output-cache-id.outputs.CLIENT_CACHE_ID }}
- name: CI:Client - Output cache ID
id: ci-client-output-cache-id
run: |
echo "CLIENT_CACHE_ID=${{ env.CLIENT_CACHE_ID }}" >> $GITHUB_OUTPUT
ci-server-verify:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./server/
needs: [ ci-client-verify ]
outputs:
SERVER_CACHE_ID: ${{ env.SERVER_CACHE_ID }}
env:
CLIENT_CACHE_ID: ${{ needs.ci-client-verify.outputs.CLIENT_CACHE_ID }}
steps:
- name: Checkout repository branch
uses: actions/checkout@v3
- name: CI:Cache name - Init
uses: ./.github/workflows/actions/cache-name
- name: CI:Server - Download CI client output
id: ci-server-download-cache
uses: actions/cache/restore@v3
continue-on-error: true
with:
path: |
./server/src/main/resources/public
key: ${{ env.SERVER_CACHE_ID }}
- name: CI - Output server cache ID
id: ci-export-cache-id
run: |
echo "SERVER_CACHE_ID=${{ env.SERVER_CACHE_ID }}" >> $GITHUB_OUTPUT
- name: Server Verify
uses: ./.github/workflows/actions/server
ci-complete:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
needs: [ ci-client-verify, ci-server-verify ]
env:
CLIENT_CACHE_ID: ${{ needs.ci-client-verify.outputs.CLIENT_CACHE_ID }}
SERVER_CACHE_ID: ${{ needs.ci-client-verify.outputs.SERVER_CACHE_ID }}
outputs:
CLIENT_CACHE_ID: ${{ env.CLIENT_CACHE_ID }}
SERVER_CACHE_ID: ${{ env.SERVER_CACHE_ID }}
steps:
- name: Checkout repository branch
uses: actions/checkout@v3
# Placeholder command just to allow this step to solely be a aggregate command such that
# other commands wanting to depend on client/server build completion can have one dependency
# instead of multiple.
# Also, re-export env/output vars from other jobs.
- name: CI:Completed - Aggregate and wait for jobs
id: ci-complete
run: |
echo "CLIENT_CACHE_ID=$CLIENT_CACHE_ID" >> $GITHUB_OUTPUT
echo "SERVER_CACHE_ID=$SERVER_CACHE_ID" >> $GITHUB_OUTPUT