Skip to content

cicd

cicd #488

Workflow file for this run

name: cicd
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 */12 * * *'
jobs:
deploy-okteto:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- run: curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
- run: chmod +x ./kubectl
- run: sudo mv ./kubectl /usr/local/bin/kubectl
- run: mkdir ${HOME}/.kube&&mkdir ${HOME}/.aws
- run: npm i -g k8ss
- run: echo -e "machine github.com\n login ${{secrets.GH_TOKEN}}" > ~/.netrc
- run: echo -e "[lambda-doc-rotary]\naws_access_key_id = ${{secrets.AWS_ACCESS_KEY}}\naws_secret_access_key = ${{secrets.AWS_SECRET_KEY}}\n" > ~/.aws/config
- run: wget https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux.amd64
- run: sudo cp sops-v3.7.3.linux.amd64 /usr/local/bin/sops
- run: sudo chmod +x /usr/local/bin/sops
- run: git clone https://github.com/Jeff-Tian/k8s-config.git ${HOME}/k8s-config
- run: k8ss switch --cluster=okteto --namespace=jeff-tian
- run: sops -d k8s/app/secrets.yaml --aws-profile lambda-doc-rotary | kubectl apply -f -
- run: kubectl apply -k k8s/app&&kubectl set image deployment id6 id6=jefftian/id6:${{ github.sha }}
# - run: kubectl apply -k k8s/redis
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "${{secrets.DOCKER_PASSWORD}}" | docker login -u "${{secrets.DOCKER_USERNAME}}" --password-stdin
- run: sh .github/ci.sh ${{ github.sha }}