github.com/dominant-strategies/go-quai@v0.28.2/.github/workflows/build-deploy.yml (about) 1 name: Build and Deploy sub-action 2 on: 3 workflow_call: 4 # Define the inputs required for the action to run 5 inputs: 6 # The environment where the deployment should occur 7 env: 8 required: true 9 type: string 10 description: The environment where the deployment should occur (e.g. dev, staging, prod). 11 12 # The awk command to update the version environment variable 13 awk: 14 required: true 15 type: string 16 description: The awk command to update the version environment variable. 17 18 # The rails command for a sanity check 19 rails: 20 required: false 21 type: string 22 default: echo "continuing." 23 description: The rails command for a sanity check. 24 25 # The branch where the action should be triggered 26 branch: 27 required: false 28 type: string 29 default: ${{ github.ref }} 30 description: The branch where the action should be triggered. 31 32 # Define the secrets required for the action to run 33 secrets: 34 # GitHub Personal Access Token for logging into GitHub 35 GH_PAT: 36 description: 'Personal Access Token (PAT) for logging into GitHub' 37 required: true 38 39 # Docker registry login credentials 40 DOCKER: 41 description: 'Docker registry login credentials' 42 required: true 43 44 # Google Cloud Platform Service Account Key for logging into the GKE cluster 45 GKE_SA_KEY: 46 description: 'Google Cloud Platform Service Account Key for logging into the GKE cluster' 47 required: true 48 49 # Project ID for the Google Cloud Platform project 50 GKE_PROJECT: 51 description: 'Project ID for the Google Cloud Platform project' 52 required: true 53 54 # Private key for signing commits and tags with GPG 55 GPG_PRIVATE_KEY: 56 description: 'Private key for signing commits and tags with GPG' 57 required: true 58 59 # Passphrase for using the GPG private key 60 GPG_PASSPHRASE: 61 description: 'Passphrase for using the GPG private key' 62 required: true 63 jobs: 64 build: 65 runs-on: ubuntu-latest 66 environment: ${{ inputs.env }} 67 steps: 68 # Checkout the specified branch from GitHub 69 - uses: actions/checkout@v3 70 with: 71 ref: ${{ inputs.branch }} 72 ssh-key: ${{ secrets.GH_PAT }} 73 74 # Import the GPG key for signing Git commits and tags 75 - name: Import GPG key 76 uses: crazy-max/ghaction-import-gpg@v5 77 with: 78 gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} 79 git_user_signingkey: true 80 git_tag_gpgsign: true 81 git_commit_gpgsign: true 82 83 # Get the current version from the 'VERSION' file 84 - name: get Version 85 run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV 86 87 # Sanity check the version we are trying to release 88 - name: Sanity Check Branch 89 run: ${{ inputs.rails }} 90 91 # Sync the version in the 'Chart.yaml' and 'values.yaml' files 92 - name: Sync Chart.yaml version 93 run: yq eval -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml 94 95 - name: Sync values.yaml version 96 run: yq eval -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml 97 # Login to the Docker registry 98 - name: Login to Docker Hub 99 uses: docker/login-action@v2 100 with: 101 username: quaibuild 102 password: ${{ secrets.DOCKER }} 103 104 # Build and push the Docker image to the registry 105 - name: Build Docker 106 run: docker build -t quainetwork/go-quai:${{ env.VERSION }} . 107 108 - name: Push to Docker Hub 109 run: docker push quainetwork/go-quai:${{ env.VERSION }} 110 111 # Tag the Git repository with the current version 112 - name: git tag 113 run: git tag -s ${{ env.VERSION }} -m ${{ env.VERSION }} && git push origin tag ${{ env.VERSION }} 114 115 # Rev the version 116 - name: Update version environment variable 117 run: echo "VERSION=$(echo $VERSION | ${{ inputs.awk }})" >> $GITHUB_ENV 118 119 # Update the 'VERSION' file to reflect the rev'd version 120 - name: Update VERSION file 121 run: echo "$VERSION" > VERSION 122 123 # Sync the version in the 'Chart.yaml' and 'values.yaml' files 124 - name: Update Chart.yaml version 125 run: yq eval -P -i ".appVersion=\"${{ env.VERSION }}\"" ./helm/Chart.yaml 126 127 - name: Update values.yaml version 128 run: yq eval -P -i ".goQuai.image.version=\"${{ env.VERSION }}\"" ./helm/values.yaml 129 130 - uses: stefanzweifel/git-auto-commit-action@v4 131 with: 132 branch: ${{ inputs.branch }} 133 commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }} 134 commit_options: -S 135 commit_user_email: ci@dominantstrategies.io 136 commit_user_name: ci-dominantstrategies