Skip to content

Commit

Permalink
move go pattern to other languages
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlincecum committed Mar 4, 2024
1 parent 95b6e9d commit afb1913
Show file tree
Hide file tree
Showing 21 changed files with 195 additions and 59 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-deploy-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ jobs:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -211,6 +220,15 @@ jobs:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Authenticate to Google Cloud
if: ${{ !inputs.skip_deploy && inputs.gcp_project_id != '' && inputs.token_secret_name != '' }}
uses: google-github-actions/[email protected] # Use the latest version available
Expand All @@ -231,6 +249,10 @@ jobs:
# set the secret value as an environment variable
echo "TOKEN=$SECRET_VALUE" >> $GITHUB_ENV
- name: Install jq
if: ${{ inputs.update_version }}
run: sudo apt-get update && sudo apt-get install -y jq

- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -325,6 +347,10 @@ jobs:
- name: Install yq
run: sudo snap install yq

- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: ${{ inputs.update_version_command }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/build-deploy-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ jobs:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -211,6 +220,15 @@ jobs:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Authenticate to Google Cloud
if: ${{ !inputs.skip_deploy && inputs.gcp_project_id != '' && inputs.token_secret_name != '' }}
uses: google-github-actions/[email protected] # Use the latest version available
Expand All @@ -231,6 +249,10 @@ jobs:
# set the secret value as an environment variable
echo "TOKEN=$SECRET_VALUE" >> $GITHUB_ENV
- name: Install jq
if: ${{ inputs.update_version }}
run: sudo apt-get update && sudo apt-get install -y jq

- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -325,6 +347,10 @@ jobs:
- name: Install yq
run: sudo snap install yq

- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: ${{ inputs.update_version_command }}
Expand Down
54 changes: 42 additions & 12 deletions .github/workflows/cut-release-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ on:
token_secret_name:
required: false
type: string
update_version:
required: false
type: boolean
default: true
secrets:
GH_PAT:
description: 'needed for github login'
Expand Down Expand Up @@ -117,6 +121,10 @@ jobs:
with:
ssh-key: ${{ secrets.GH_PAT }}

- name: Install jq
if: ${{ inputs.update_version }}
run: sudo apt-get update && sudo apt-get install -y jq

- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -144,10 +152,16 @@ jobs:
echo node version $(node -v)
echo npm version $(npm -v)
- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: |
NEW_VERSION=$(npm version prerelease --preid=rc --no-git-tag-version | sed 's/^v//')
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Update Chart.yaml version
run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml
Expand Down Expand Up @@ -190,9 +204,11 @@ jobs:
echo "CAMEL_CASE_REPO_NAME=$camel_case_name" >> $GITHUB_ENV
- name: Update Version
if: ${{ inputs.update_version }}
run: |
NEW_VERSION=$(npm version preminor --preid=pre --no-git-tag-version | sed 's/^v//')
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i minor $(jq -r '.version' package.json | sed 's/^v//;s/-pre$//'))-pre" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Sync package-lock.json
run: npm i --package-lock-only --ignore-scripts
Expand All @@ -219,6 +235,10 @@ jobs:
with:
ssh-key: ${{ secrets.GH_PAT }}

- name: Install jq
if: ${{ inputs.update_version }}
run: sudo apt-get update && sudo apt-get install -y jq

- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -246,10 +266,16 @@ jobs:
echo node version $(node -v)
echo npm version $(npm -v)
- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: |
NEW_VERSION=$(npm version prerelease --preid=rc --no-git-tag-version | sed 's/^v//')
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Update Chart.yaml version
run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml
Expand Down Expand Up @@ -292,9 +318,11 @@ jobs:
echo "CAMEL_CASE_REPO_NAME=$camel_case_name" >> $GITHUB_ENV
- name: Update Version
if: ${{ inputs.update_version }}
run: |
NEW_VERSION=$(npm version preminor --preid=pre --no-git-tag-version | sed 's/^v//')
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i minor $(jq -r '.version' package.json | sed 's/^v//;s/-pre$//'))-pre" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Sync package-lock.json
run: npm i --package-lock-only --ignore-scripts
Expand Down Expand Up @@ -367,6 +395,7 @@ jobs:
echo env: ${{ inputs.env }}
- name: Update Version
if: ${{ inputs.update_version }}
run: |
echo "v$(semver -i patch $(sed 's/^v//' VERSION))" > VERSION
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
Expand Down Expand Up @@ -414,6 +443,7 @@ jobs:
echo "CAMEL_CASE_REPO_NAME=$camel_case_name" >> $GITHUB_ENV
- name: Update Version
if: ${{ inputs.update_version }}
run: |
echo "v$(semver -i minor $(cat VERSION | sed 's/^v//;s/-pre$//'))-pre" > VERSION
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
Expand Down Expand Up @@ -445,9 +475,9 @@ jobs:

with:
env: ${{ inputs.env }}
update_version_command: npm version prerelease --preid=rc --no-git-tag-version
update_version_command: "jq --arg new_version \"v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))\" '.version = $new_version' package.json > temp.json && mv temp.json package.json"
branch: ${{ needs.cutReleaseCandidateJS.outputs.branch }}
rails: '[[ "$VERSION" =~ "rc" ]]'
rails: '[[ ! "$VERSION" =~ "rc" ]]'
update_version: true
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
Expand All @@ -474,9 +504,9 @@ jobs:

with:
env: ${{ inputs.env }}
update_version_command: npm version prerelease --preid=rc --no-git-tag-version
update_version_command: "jq --arg new_version \"v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))\" '.version = $new_version' package.json > temp.json && mv temp.json package.json"
branch: ${{ needs.cutReleaseCandidateTS.outputs.branch }}
rails: '[[ "$VERSION" =~ "rc" ]]'
rails: '[[ ! "$VERSION" =~ "rc" ]]'
update_version: true
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
Expand Down
50 changes: 40 additions & 10 deletions .github/workflows/deploy-prod-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ on:
token_secret_name:
required: false
type: string
update_version:
required: false
type: boolean
default: true
secrets:
GH_PAT:
description: 'needed for github login'
Expand Down Expand Up @@ -109,6 +113,15 @@ jobs:
with:
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -136,12 +149,16 @@ jobs:
echo node version $(node -v)
echo npm version $(npm -v)
- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: |
npm version patch --no-git-tag-version
VERSION_VALUE=$(sudo yq eval '.version' package.json | head -n 1)
echo "VERSION=$VERSION_VALUE"
echo "VERSION=$VERSION_VALUE" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Update Chart.yaml version
run: yq eval -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml
Expand All @@ -163,6 +180,15 @@ jobs:
with:
ssh-key: ${{ secrets.GH_PAT }}

- name: Import GPG Key
if: ${{ inputs.update_version }}
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
- name: Set Repo Name
run: |
repo_name=$(basename ${{ github.repository }})
Expand Down Expand Up @@ -190,12 +216,16 @@ jobs:
echo node version $(node -v)
echo npm version $(npm -v)
- name: install semver globally
if: ${{ inputs.update_version }}
run: npm install -g semver

- name: Update Version
if: ${{ inputs.update_version }}
run: |
npm version patch --no-git-tag-version
VERSION_VALUE=$(sudo yq eval '.version' package.json | head -n 1)
echo "VERSION=$VERSION_VALUE"
echo "VERSION=$VERSION_VALUE" >> $GITHUB_ENV
jq --arg new_version "v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))" '.version = $new_version' package.json > temp.json && mv temp.json package.json
NEW_VERSION = $(jq -r '.version' package.json)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Update Chart.yaml version
run: yq eval -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml
Expand Down Expand Up @@ -289,7 +319,7 @@ jobs:
env: ${{ inputs.env }}
update_version_command: npm version prepatch --preid=rc --no-git-tag-version
rails: '[[ ! "$VERSION" =~ "rc" ]] && [[ ! "$VERSION" =~ "pre" ]]'
update_version: true
update_version: {{ inputs.update_version }}}
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
needs_export: ${{ inputs.needs_export }}
Expand All @@ -313,7 +343,7 @@ jobs:
env: ${{ inputs.env }}
update_version_command: npm version prepatch --preid=rc --no-git-tag-version
rails: '[[ ! "$VERSION" =~ "rc" ]] && [[ ! "$VERSION" =~ "pre" ]]'
update_version: true
update_version: {{ inputs.update_version }}}
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
needs_export: ${{ inputs.needs_export }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-sandbox-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ jobs:
GH_GCP_TOKEN: ${{ secrets.GH_GCP_TOKEN }}
with:
env: ${{ inputs.env }}
update_version_command: npm version prerelease --preid=rc --no-git-tag-version
update_version_command: "jq --arg new_version \"v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))\" '.version = $new_version' package.json > temp.json && mv temp.json package.json"
rails: '[[ ! "$VERSION" =~ "pre" ]]'
update_version: true
update_version: {{ inputs.update_version }}
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
needs_export: ${{ inputs.needs_export }}
Expand All @@ -141,9 +141,9 @@ jobs:
GH_GCP_TOKEN: ${{ secrets.GH_GCP_TOKEN }}
with:
env: ${{ inputs.env }}
update_version_command: npm version prerelease --preid=rc --no-git-tag-version
update_version_command: "jq --arg new_version \"v$(semver -i patch $(jq -r '.version' package.json | sed 's/^v//'))\" '.version = $new_version' package.json > temp.json && mv temp.json package.json"
rails: '[[ ! "$VERSION" =~ "pre" ]]'
update_version: true
update_version: ${{ inputs.update_version }}
cloud_deploy: ${{ inputs.cloud_deploy }}
needs_build: ${{ inputs.needs_build }}
needs_export: ${{ inputs.needs_export }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test-remote-cut-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
with:
branch: main
needs_build: true
build_command: "make go-quai"
needs_docker: false
include_chart: false
cloud_deploy: false
build_command: "npm run build"
needs_docker: true
include_chart: true
cloud_deploy: true
skip_deploy: true
update_version: true
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-remote-dev-manual-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: dominant-strategies/quai-cicd/.github/workflows/deploy-dev-common.yml@main
with:
needs_build: true
build_command: "make go-quai"
build_command: "npm run build"
needs_docker: false
include_chart: false
cloud_deploy: false
Expand Down
Loading

0 comments on commit afb1913

Please sign in to comment.