-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pre-commit helper and workflow to build and deploy all the envi…
…ronments
- Loading branch information
Showing
3 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: bld_all | ||
|
||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version_tag: | ||
description: 'version tag to use' | ||
required: false | ||
default: "next_tag" | ||
type: string | ||
|
||
workflow_dispatch: | ||
inputs: | ||
version_tag: | ||
description: 'version tag to use' | ||
required: false | ||
default: "next_tag" | ||
type: string | ||
|
||
jobs: | ||
|
||
bld_prod: | ||
uses: ./.github/workflows/bld_maven.yml | ||
secrets: inherit # pass all secrets | ||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
with: | ||
artifact_name: prod | ||
version_tag: ${{ inputs.version_tag }} | ||
|
||
bld_sandbox: | ||
uses: ./.github/workflows/bld_maven.yml | ||
secrets: inherit # pass all secrets | ||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
with: | ||
artifact_name: sandbox | ||
version_tag: ${{ inputs.version_tag }} | ||
|
||
bld_qa: | ||
uses: ./.github/workflows/bld_maven.yml | ||
secrets: inherit # pass all secrets | ||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
with: | ||
artifact_name: qa | ||
version_tag: ${{ inputs.version_tag }} | ||
|
||
bld_int: | ||
uses: ./.github/workflows/bld_maven.yml | ||
secrets: inherit # pass all secrets | ||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
with: | ||
artifact_name: int | ||
version_tag: ${{ inputs.version_tag }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: bld_maven | ||
run-name: bld-{{ inputs.artifact_name }} | ||
|
||
permissions: | ||
checks: write | ||
contents: read | ||
issues: read | ||
pull-requests: write | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
artifact_name: | ||
description: 'Name of the artifact env' | ||
required: false | ||
default: "prod" | ||
type: string | ||
version_tag: | ||
description: 'Name of the tag to build' | ||
required: false | ||
default: "v2.0.1" | ||
type: string | ||
|
||
workflow_dispatch: | ||
inputs: | ||
artifact_name: | ||
description: 'Name of the artifact env' | ||
required: false | ||
default: "prod" | ||
type: string | ||
version_tag: | ||
description: 'Name of the tag to build' | ||
required: false | ||
default: "v2.0.1" | ||
type: string | ||
|
||
jobs: | ||
bld_maven: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: find next version | ||
id: version | ||
uses: ORCID/version-bump-action@main | ||
with: | ||
version_tag: ${{ inputs.version_tag }} | ||
|
||
- name: Set up Open JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
cache: 'maven' | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 'v16.13.2' | ||
#18.7.0 | ||
|
||
- name: show path | ||
run: | | ||
echo "$PATH" | ||
which java | ||
echo "$JAVA_HOME" | ||
echo "$tag_numeric" | ||
echo "$project" | ||
shell: bash | ||
env: | ||
version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}" | ||
project: "${{ inputs.artifact_name }}" | ||
|
||
- name: bump version | ||
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 | ||
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 status | ||
git diff | ||
- name: build our project and deploy | ||
run: | | ||
mvn -T 1C --batch-mode \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
--settings settings-deploy.xml \ | ||
--file "pom.xml" \ | ||
-DaltReleaseDeploymentRepository="github::${ARTIFACT_URL}${ARTIFACT_REPO_PATH}" \ | ||
--activate-profiles "${build_env}" -Dnodejs.workingDirectory=. \ | ||
deploy -Dmaven.test.skip | ||
echo "------------------------------------------------------" | ||
find . -name '*.war' | ||
find . -name '*.jar' | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
ARTIFACT_URL: "${{ secrets.ARTIFACT_URL }}" | ||
ARTIFACT_REPO_PATH: "${{ secrets.ARTIFACT_REPO_PATH }}" | ||
ARTIFACT_USER: "${{ secrets.ARTIFACT_USER }}" | ||
ARTIFACT_PASSWORD: "${{ secrets.ARTIFACT_PASSWORD }}" | ||
build_env: "${{ inputs.artifact_name }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
repos: | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-added-large-files | ||
name: check for added large files | ||
description: prevents giant files from being committed. | ||
entry: check-added-large-files | ||
language: python | ||
stages: [commit, push, manual] | ||
|
||
- repo: local # Use a local repository | ||
hooks: | ||
- id: actionlint | ||
name: Lint GitHub Actions workflow files | ||
description: Runs actionlint to lint GitHub Actions workflow files | ||
entry: actionlint | ||
language: golang | ||
additional_dependencies: [github.com/rhysd/actionlint/cmd/[email protected]] | ||
types: ["yaml"] | ||
files: "^.github/workflows/" | ||
|