Skip to content

Commit

Permalink
Merge pull request #1945 from ORCID/chore/migrate-full-gha-pipeline-t…
Browse files Browse the repository at this point in the history
…o-prod-for-orcid-angular-repo

chore/migrate-full-gha-pipeline-to-prod-for-orcid-angular-repo
  • Loading branch information
gilesw authored May 4, 2023
2 parents 9432c99 + d2191c5 commit 83f709d
Show file tree
Hide file tree
Showing 25 changed files with 599 additions and 189 deletions.
52 changes: 38 additions & 14 deletions .github/workflows/bld_all.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: bld_all

#NOTE: this deploys assets as well as builds

permissions:
checks: write
contents: read
Expand All @@ -10,29 +12,47 @@ on:
workflow_call:
inputs:
version_tag:
description: 'version tag to use'
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'latest'
type: string
bump:
description: 'whether to bump the version number by a major minor patch'
required: false
default: 'next_tag'
default: 'patch'
type: string
git_checkout:
description: 'branch or tag to checkout for building'
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: 'main'
default: "default"
type: string

workflow_dispatch:
inputs:
version_tag:
description: 'version tag to use'
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'next_tag'
default: 'latest'
type: string
git_checkout:
description: 'branch or tag to checkout for building'
bump:
description: |
How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
'#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
required: false
default: 'main'
options:
- patch
- minor
- major
- none
type: choice
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string



jobs:
bld_prod:
uses: ./.github/workflows/bld_maven.yml
Expand All @@ -45,7 +65,8 @@ jobs:
with:
artifact_name: prod
version_tag: ${{ inputs.version_tag }}
git_checkout: ${{ inputs.git_checkout }}
bump: ${{ inputs.bump }}
ref: ${{ inputs.ref }}

bld_sandbox:
uses: ./.github/workflows/bld_maven.yml
Expand All @@ -58,7 +79,8 @@ jobs:
with:
artifact_name: sandbox
version_tag: ${{ inputs.version_tag }}
git_checkout: ${{ inputs.git_checkout }}
bump: ${{ inputs.bump }}
ref: ${{ inputs.ref }}

bld_qa:
uses: ./.github/workflows/bld_maven.yml
Expand All @@ -71,7 +93,8 @@ jobs:
with:
artifact_name: qa
version_tag: ${{ inputs.version_tag }}
git_checkout: ${{ inputs.git_checkout }}
bump: ${{ inputs.bump }}
ref: ${{ inputs.ref }}

bld_int:
uses: ./.github/workflows/bld_maven.yml
Expand All @@ -84,4 +107,5 @@ jobs:
with:
artifact_name: int
version_tag: ${{ inputs.version_tag }}
git_checkout: ${{ inputs.git_checkout }}
bump: ${{ inputs.bump }}
ref: ${{ inputs.ref }}
27 changes: 27 additions & 0 deletions .github/workflows/bld_all_yarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: bld_all_yarn

on:
workflow_call:

workflow_dispatch:

jobs:
bld_prod:
uses: ./.github/workflows/bld_yarn.yml
with:
artifact_name: prod
# bld_sandbox:
# uses: ./.github/workflows/bld_yarn.yml
# with:
# artifact_name: sandbox
#
# bld_qa:
# uses: ./.github/workflows/bld_yarn.yml
# with:
# artifact_name: qa
#
# bld_int:
# uses: ./.github/workflows/bld_yarn.yml
# with:
# artifact_name: int
#
72 changes: 49 additions & 23 deletions .github/workflows/bld_maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ on:
required: false
default: 'prod'
type: string
git_checkout:
description: 'branch or tag to checkout for building'
required: false
default: 'main'
type: string
version_tag:
description: 'Name of the tag to build'
required: false
default: 'v2.0.1'
default: 'latest'
type: string
bump:
description: 'whether to bump the version number by a major minor patch amount or none'
required: false
default: 'patch'
type: string
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string

workflow_dispatch:
Expand All @@ -33,30 +38,52 @@ on:
required: false
default: 'prod'
type: string
git_checkout:
description: 'branch or tag to checkout for building'
version_tag:
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'main'
default: 'latest'
type: string
version_tag:
description: 'Name of the tag to build'
bump:
description: |
How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
'#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
required: false
options:
- patch
- minor
- major
- none
type: choice
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: 'v2.0.1'
default: "default"
type: string

jobs:
bld_maven:
runs-on: ubuntu-latest
steps:
- name: git-checkout-ref-action
id: ref
uses: ORCID/git-checkout-ref-action@main
with:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}

- uses: actions/checkout@v3
with:
ref: ${{ inputs.git_checkout }}
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
# NOTE: history does not include tags!
fetch-depth: 100

- name: find next version
id: version
uses: ORCID/version-bump-action@main
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}

- name: Set up Open JDK 11
uses: actions/setup-java@v3
Expand All @@ -65,11 +92,11 @@ jobs:
java-version: '11'
cache: 'maven'

- name: setup node
uses: actions/setup-node@v3
with:
node-version: 'v16.13.2'
#18.7.0
# FIXME: think that maven somehow pulls this in, so never cached
# - name: setup node
# uses: actions/setup-node@v3
# with:
# node-version: 'v16.13.2'

- name: show path
run: |
Expand All @@ -78,25 +105,24 @@ jobs:
echo "$JAVA_HOME"
echo "$tag_numeric"
echo "$project"
ls -la
shell: bash
env:
version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}'
project: '${{ inputs.artifact_name }}'

- name: bump version
- name: bump version using prod profile
run: |
mvn -T 1C --batch-mode versions:set \
-DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false --activate-profiles "${build_env}" -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false --activate-profiles prod -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
env:
version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}'
build_env: '${{ inputs.artifact_name }}'

- name: check some build related things
run: |
cat /home/runner/.m2/settings.xml
git --version
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git --version
git status
git diff
git rev-parse --abbrev-ref HEAD
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/bld_yarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: bld_yarn
run-name: bld-{{ inputs.artifact_name }}

permissions:
checks: write
contents: read
issues: read

on:
workflow_call:
inputs:
artifact_name:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string

workflow_dispatch:
inputs:
artifact_name:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string

jobs:
bld_yarn:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'v16.13.2'
cache: 'yarn'
- run: yarn
- run: yarn build:${{ inputs.artifact_name }}
Loading

0 comments on commit 83f709d

Please sign in to comment.