cambios #1
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: master CI, CD workflow | |
on: | |
push: | |
branches: [ "master"] | |
pull_request: | |
branches: [ "master"] | |
jobs: | |
master-ci-cd: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
- name: make .env | |
uses: SpicyPizza/create-envfile@v1.3 | |
with: | |
envkey_DEV_DATABASE_URL : ${{ secrets.DEV_DATABASE_URL }} | |
file_name: .env | |
fail_on_empty: false | |
- name: show dir, .env file | |
run: | | |
cat .env | |
- name: Build the custom Docker image | |
run: docker build -t ${{secrets.DOCKER_USER}}/${{secrets.MODEL_NAME}}:${{github.sha}} . | |
- name: show docker images | |
run: docker images | |
- name: docker login | |
env: | |
DOCKER_USER: ${{secrets.DOCKER_USER}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
run: | | |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
- name: Docker Push | |
run: docker push ${{secrets.DOCKER_USER}}/${{secrets.MODEL_NAME}}:${{github.sha}} | |
- name: update docker user in k8 | |
run: sed -i 's/{docker_user}/${{secrets.DOCKER_USER}}/g' manifests/k8s.yml | |
- name: update model name in k8 | |
run: sed -i 's/{model_name}/${{secrets.MODEL_NAME}}/g' manifests/k8s.yml | |
- name: update _ by - | |
run: sed -i 's/_/-/g' manifests/k8s.yml | |
- name: update sha in k8 | |
run: sed -i 's/{github.sha}/${{github.sha}}/g' manifests/k8s.yml | |
- name: ls -la | |
run: cat manifests/k8s.yml | |
- uses: okteto/context@2.7.0 | |
with: | |
token: ${{secrets.OKTETO_TOKEN }} | |
- name: Deploy and Wait | |
uses: okteto/actions/deploy@v1 | |
env: | |
KUBECONFIG: ${{ steps.namespace.outputs.kubeconfig }} | |
with: | |
namespace: ${{secrets.OKTETO_NAMESPACE }} | |
manifest: manifests/k8s.yml | |
tag: ${{ secrets.DOCKER_USERNAME }}/${{secrets.MODEL_NAME}}:${{github.sha}} |