diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml new file mode 100644 index 0000000000..534dfbf730 --- /dev/null +++ b/.github/workflows/branch.yml @@ -0,0 +1,21 @@ +name: Patch Release Branch Workflow +on: + pull_request: + types: [closed] + branches: + - 'v?[0-9]+.[0-9]+' +jobs: + call-common-workflow: + uses: dominant-strategies/quai-cicd/.github/workflows/deploy-sandbox-common.yml@main + with: + needs_build: true + build_command: "[ -f network.env.dist ] && mv network.env.dist network.env; make go-quai" + needs_docker: false + include_chart: false + cloud_deploy: false + skip_deploy: true + update_version: false + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml deleted file mode 100644 index 392855c888..0000000000 --- a/.github/workflows/build-deploy.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: Build and Deploy sub-action -on: - workflow_call: - # Define the inputs required for the action to run - inputs: - # The environment where the deployment should occur - env: - required: true - type: string - description: The environment where the deployment should occur (e.g. dev, staging, prod). - - # The awk command to update the version environment variable - awk: - required: true - type: string - description: The awk command to update the version environment variable. - - # The rails command for a sanity check - rails: - required: false - type: string - default: echo "continuing." - description: The rails command for a sanity check. - - # The branch where the action should be triggered - branch: - required: false - type: string - default: ${{ github.ref }} - description: The branch where the action should be triggered. - - # Define the secrets required for the action to run - secrets: - # GitHub Personal Access Token for logging into GitHub - GH_PAT: - description: 'Personal Access Token (PAT) for logging into GitHub' - required: true - - # Docker registry login credentials - DOCKER: - description: 'Docker registry login credentials' - required: true - - # Google Cloud Platform Service Account Key for logging into the GKE cluster - GKE_SA_KEY: - description: 'Google Cloud Platform Service Account Key for logging into the GKE cluster' - required: true - - # Project ID for the Google Cloud Platform project - GKE_PROJECT: - description: 'Project ID for the Google Cloud Platform project' - required: true - - # Private key for signing commits and tags with GPG - GPG_PRIVATE_KEY: - description: 'Private key for signing commits and tags with GPG' - required: true - - # Passphrase for using the GPG private key - GPG_PASSPHRASE: - description: 'Passphrase for using the GPG private key' - required: true -jobs: - build: - runs-on: ubuntu-latest - environment: ${{ inputs.env }} - steps: - # Checkout the specified branch from GitHub - - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - ssh-key: ${{ secrets.GH_PAT }} - - # Import the GPG key for signing Git commits and tags - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - git_user_signingkey: true - git_tag_gpgsign: true - git_commit_gpgsign: true - - # Get the current version from the 'VERSION' file - - name: get Version - run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - # Sanity check the version we are trying to release - - name: Sanity Check Branch - run: ${{ inputs.rails }} - - # Sync the version in the 'Chart.yaml' and 'values.yaml' files - - name: Sync Chart.yaml version - run: yq eval -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml - - - name: Sync values.yaml version - run: yq eval -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml - # Login to the Docker registry - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: quaibuild - password: ${{ secrets.DOCKER }} - - # Build and push the Docker image to the registry - - name: Build Docker - run: docker build -t quainetwork/go-quai:${{ env.VERSION }} . - - - name: Push to Docker Hub - run: docker push quainetwork/go-quai:${{ env.VERSION }} - - # Tag the Git repository with the current version - - name: git tag - run: git tag -s ${{ env.VERSION }} -m ${{ env.VERSION }} && git push origin tag ${{ env.VERSION }} - - # Rev the version - - name: Update version environment variable - run: echo "VERSION=$(echo $VERSION | ${{ inputs.awk }})" >> $GITHUB_ENV - - # Update the 'VERSION' file to reflect the rev'd version - - name: Update VERSION file - run: echo "$VERSION" > VERSION - - # Sync the version in the 'Chart.yaml' and 'values.yaml' files - - name: Update Chart.yaml version - run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml - - - name: Update values.yaml version - run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: ${{ inputs.branch }} - commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }} - commit_options: -S - commit_user_email: ci@dominantstrategies.io - commit_user_name: ci-dominantstrategies diff --git a/.github/workflows/build-on-pr.yml b/.github/workflows/build-on-pr.yml index c9195c0d36..4bbe865b13 100644 --- a/.github/workflows/build-on-pr.yml +++ b/.github/workflows/build-on-pr.yml @@ -6,19 +6,18 @@ on: - synchronize - reopened jobs: - build: - runs-on: ubuntu-latest + call-common-workflow: + uses: dominant-strategies/quai-cicd/.github/workflows/deploy-dev-common.yml@main + with: + needs_build: true + build_command: "[ -f network.env.dist ] && mv network.env.dist network.env; make go-quai" + needs_docker: false + include_chart: false + cloud_deploy: false + skip_deploy: true + update_version: false + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: actions/setup-go@v4 - with: - go-version: '1.20' - - - name: create network.env from dist - run: mv network.env.dist network.env - - - name: build - run: make go-quai diff --git a/.github/workflows/cut-minor-release.yml b/.github/workflows/cut-minor-release.yml index 1eed7162db..7dae3bd4c6 100644 --- a/.github/workflows/cut-minor-release.yml +++ b/.github/workflows/cut-minor-release.yml @@ -1,96 +1,24 @@ -name: Cut a new Minor Release Branch -on: workflow_dispatch +name: Cut Minor Release Workflow +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to use' + required: true + default: 'main' jobs: - cutReleaseCandidate: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.set-branch.outputs.branch }} - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - ssh-key: ${{ secrets.GH_PAT }} - - # Import the GPG key for signing Git commits and tags - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - git_user_signingkey: true - git_tag_gpgsign: true - git_commit_gpgsign: true - - - name: get Version - run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Update version environment variable - run: echo "VERSION=$(echo $VERSION | sed 's/pre/rc/g' | awk -F. '{print $1"."$2"."$3"."0}')" >> $GITHUB_ENV - - - name: Update 'VERSION' file - run: echo "$VERSION" > VERSION - - - name: Update Chart.yaml version - run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml - - - name: Update values.yaml version - run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml - - - name: Update version environment variable e.g. v0.1.0-pre.0 -> v0.1 - run: echo "BRANCH=$(echo $VERSION | sed 's/\.[0-9]*-.*//g')" >> $GITHUB_ENV - - - name: Store version in branch variable - id: set-branch - run: echo "::set-output name=branch::${{ env.BRANCH }}" - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }} - branch: ${{ env.BRANCH }} - create_branch: true - commit_options: -S - commit_user_email: ci@dominantstrategies.io - commit_user_name: ci-dominantstrategies - - - - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - ssh-key: ${{ secrets.GH_PAT }} - - - name: get Version - run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Update version environment variable - run: echo "VERSION=$(echo $VERSION | sed "s/-.*//g" | awk -F. '{print $1"."$2+1"."0"-pre.0"}')" >> $GITHUB_ENV - - - name: Update 'VERSION' file - run: echo "$VERSION" > VERSION - - - name: Update Chart.yaml version - run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml - - - name: Update values.yaml version - run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Cut ${{ env.BRANCH }} release branch and rev'd 'VERSION' file to ${{ env.VERSION }} - branch: main - commit_options: -S - commit_user_email: ci@dominantstrategies.io - commit_user_name: ci-dominantstrategies - deployReleaseCandidate: - uses: ./.github/workflows/build-deploy.yml + call-common-workflow: + uses: dominant-strategies/quai-cicd/.github/workflows/cut-release-common.yml@main + with: + branch: main + needs_build: true + build_command: "[ -f network.env.dist ] && mv network.env.dist network.env; make go-quai" + needs_docker: false + include_chart: false + cloud_deploy: false + skip_deploy: true + update_version: true secrets: - DOCKER: ${{ secrets.DOCKER }} GH_PAT: ${{ secrets.GH_PAT }} - GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }} - GKE_PROJECT: ${{ secrets.GKE_PROJECT }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - with: - env: quai-sandbox - awk : sed -e "s/pre/rc/g" | awk -F . '{print $1"."$2"."$3"."$4+1}' - rails: '[[ ! "$VERSION" =~ "pre" ]]' - branch: ${{ needs.cutReleaseCandidate.outputs.branch }} - needs: [cutReleaseCandidate] + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml deleted file mode 100644 index 4d1df230bf..0000000000 --- a/.github/workflows/deploy-dev.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Build and Deploy to Dev -on: workflow_dispatch -jobs: - buildDeployDev: - uses: ./.github/workflows/build-deploy.yml - secrets: - DOCKER: ${{ secrets.DOCKER }} - GH_PAT: ${{ secrets.GH_PAT }} - GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }} - GKE_PROJECT: ${{ secrets.GKE_PROJECT }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - with: - env: quai-dev - awk: awk -F. '{print $1"."$2"."$3"."$4+1}' diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml deleted file mode 100644 index 10588a91c8..0000000000 --- a/.github/workflows/deploy-prod.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build and Deploy to Prod -on: workflow_dispatch -jobs: - buildDeployProd: - uses: ./.github/workflows/build-deploy.yml - secrets: - DOCKER: ${{ secrets.DOCKER }} - GH_PAT: ${{ secrets.GH_PAT }} - GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }} - GKE_PROJECT: ${{ secrets.GKE_PROJECT }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - with: - env: quai-prod - awk: sed "s/-.*//g" | awk -F. '{print $1"."$2"."$3+1"-rc.0"}' - rails: '[[ ! "$VERSION" =~ "rc" ]] && [[ ! "$VERSION" =~ "pre" ]]' diff --git a/.github/workflows/deploy-sandbox.yml b/.github/workflows/deploy-sandbox.yml deleted file mode 100644 index 7b0fb29b97..0000000000 --- a/.github/workflows/deploy-sandbox.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Build and Deploy to Sandbox -on: workflow_dispatch -jobs: - buildDeploySandbox: - uses: ./.github/workflows/build-deploy.yml - secrets: - DOCKER: ${{ secrets.DOCKER }} - GH_PAT: ${{ secrets.GH_PAT }} - GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }} - GKE_PROJECT: ${{ secrets.GKE_PROJECT }} - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - with: - env: quai-sandbox - awk: sed -e "s/pre/rc/g" | awk -F . '{print $1"."$2"."$3"."$4+1}' - rails: '[[ ! "$VERSION" =~ "pre" ]]' diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000000..7a0fc0af48 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,20 @@ +name: Dev Workflow +on: + pull_request: + types: [closed] + branches: [ "main" ] +jobs: + call-common-workflow: + uses: dominant-strategies/quai-cicd/.github/workflows/deploy-dev-common.yml@main + with: + needs_build: true + build_command: "[ -f network.env.dist ] && mv network.env.dist network.env; make go-quai" + needs_docker: false + include_chart: false + cloud_deploy: false + skip_deploy: true + update_version: false + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} diff --git a/.github/workflows/lint-on-pr.yml b/.github/workflows/lint-on-pr.yml deleted file mode 100644 index e795bcbc41..0000000000 --- a/.github/workflows/lint-on-pr.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lint on PR -on: - pull_request: - types: - - opened - - synchronize - - reopened - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: actions/setup-go@v4 - with: - go-version: '1.19' - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: latest diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml new file mode 100644 index 0000000000..d52b59904f --- /dev/null +++ b/.github/workflows/patch.yml @@ -0,0 +1,17 @@ +name: Patch Release Branch Workflow +on: workflow_dispatch +jobs: + call-common-workflow: + uses: dominant-strategies/quai-cicd/.github/workflows/deploy-sandbox-common.yml@main + with: + needs_build: true + build_command: "[ -f network.env.dist ] && mv network.env.dist network.env; make go-quai" + needs_docker: false + include_chart: false + cloud_deploy: false + skip_deploy: true + update_version: true + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} diff --git a/.github/workflows/test-on-pr.yml b/.github/workflows/test-on-pr.yml deleted file mode 100644 index 5c595f7a6e..0000000000 --- a/.github/workflows/test-on-pr.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Test on PR -on: - pull_request: - types: - - opened - - synchronize - - reopened - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - uses: actions/setup-go@v4 - with: - go-version: '1.19' - - - name: test - run: go test ./... diff --git a/VERSION b/VERSION index 31950dacac..b5ab6f109c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.28.0 +v0.28.0-pre