0pens0 deploying #137
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: Deploy to K8s | |
run-name: ${{ github.actor }} deploying | |
on: | |
push: | |
branches: | |
- "dev" | |
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 | |
- name: Install Tanzu plugins | |
#env: | |
#TANZU_CLI_INCLUDE_DEACTIVATED_PLUGINS_TEST_ONLY: 1 | |
run: | | |
tanzu plugin install build | |
tanzu plugin install resource | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Build and Deploy to Tanzu Space | |
env: | |
TANZU_API_TOKEN: ${{ secrets.API_TOKEN }} | |
run: | | |
tanzu login --endpoint ${{ vars.API_ENDPOINT }} | |
tanzu build config --build-plan-source-type=file --build-plan-source conf/platform-config.yml --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 dev environment | |
run: | | |
git config --global user.name "0pens0" | |
git config --global user.email [email protected] | |
git clone https://github.com/0pens0/spring-metal-gitops -b stage | |
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-metal-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-metal-stage | |
cd spring-metal-gitops | |
git add . | |
git commit -m "push new version to stage" | |
git push | |
cd .. | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: dev | |
commit_user_name: 0pens0 | |
- run: echo "🍏 This job's status is ${{ job.status }}." |