0pens0 deploying #9
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
name: Build and Deploy to TP | |
run-name: ${{ github.actor }} deploying | |
on: | |
push: | |
branches: | |
- "gitops" | |
jobs: | |
gitops-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Tanzu CLI | |
env: | |
TANZU_CLI_VERSION: ${{vars.TANZU_CLI_VERSION}} | |
run: | | |
curl -Lo tanzu-cli-linux-amd64.tar.gz https://github.com/vmware-tanzu/tanzu-cli/releases/download/${TANZU_CLI_VERSION}/tanzu-cli-linux-amd64.tar.gz | |
curl -Lo tanzu-cli-binaries-checksums.txt https://github.com/vmware-tanzu/tanzu-cli/releases/download/${TANZU_CLI_VERSION}/tanzu-cli-binaries-checksums.txt | |
if [ "$(cat tanzu-cli-binaries-checksums.txt | grep tanzu-cli-linux-amd64.tar.gz)" != "$(sha256sum tanzu-cli-linux-amd64.tar.gz)" ]; then echo "Checksum does not match"; exit 1; fi | |
tar -xf tanzu-cli-linux-amd64.tar.gz | |
mv ${TANZU_CLI_VERSION}/tanzu-cli-linux_amd64 /usr/local/bin/tanzu | |
tanzu ceip-participation set false | |
tanzu config eula accept | |
tanzu init | |
tanzu version | |
tanzu plugin install build | |
tanzu plugin install resource | |
tanzu plugin install project | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Build | |
env: | |
TANZU_API_TOKEN: ${{ secrets.API_TOKEN }} | |
ENDPOINT: ${{ vars.API_ENDPOINT || 'console.cloud.vmware.com' }} | |
run: | | |
tanzu login | |
tanzu project use tanzu-platform-vcf | |
tanzu build config --build-plan-source-type=git --build-plan-source https://github.com/0pens0/spring-metal-gitops.git --containerapp-registry ${{ vars.BUILD_REGISTRY_CONF }} | |
echo ${{ vars.REGISTRY }} | |
echo ${{ vars.REGISTRY_USER_NAME }} | |
echo ${{ vars.BUILD_REGISTRY_CONF }} | |
docker login ${{ vars.REGISTRY }} -u ${{ vars.REGISTRY_USER_NAME }} -p ${{ secrets.RERGISTRY_PASS }} | |
tanzu build -o .build-output | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: ${{secrets.GIT_CREDENTIALS}} | |
- name: Promote to TPK8S Gitops | |
run: | | |
git config --global user.name "0pens0" | |
git config --global user.email [email protected] | |
git clone https://github.com/0pens0/spring-metal-gitops | |
tanzu promote --from-build .build-output/apps.tanzu.vmware.com.ContainerApp/spring-metal/kubernetes-carvel-package/output --to spring-metal-gitops/git-ops/spaces/spring-dev | |
tanzu promote --from-build .build-output/apps.tanzu.vmware.com.ContainerApp/spring-metal/kubernetes-carvel-package/output --to spring-metal-gitops/git-ops/spaces/spring-stage | |
cd spring-metal-gitops | |
git add . | |
git commit -m "push new version to stage" | |
git push | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: dev | |
commit_user_name: 0pens0 | |
- run: echo "🍏 This job's status is ${{ job.status }}." |