diff --git a/.github/workflows/local-build-push.yaml b/.github/workflows/local-build-push.yaml deleted file mode 100644 index 63e97c6..0000000 --- a/.github/workflows/local-build-push.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: local-build -run-name: local-build ${{ github.actor }} -on: - # push: - # tags: - # - v1.** - # branches: - # - 'main' - # branches: - # - 'release-*' - - # Allow run workflow manually from Action tab - workflow_dispatch: - inputs: - IMAGE_VER: - description: "version for build image" - type: string - -env: - REGISTRY: docker.frappet.com - IMAGE_NAME: demo/qualifying-exam-cms - DEPLOY_HOST: frappet.com - COMPOSE_PATH: /home/frappet/docker/bma-ehr-qualifying-cms - -jobs: - # act workflow_dispatch --reuse -W .github/workflows/local-build-push.yaml --input IMAGE_VER=v0.2.17-dev -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd - local-image: - runs-on: ubuntu-latest - steps: - - name: Check out code # checkout only cms is possible but I checkout all - uses: actions/checkout@v3 - - name: Gen Version - id: gen_ver - run: | - IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} - echo "{\"version\":\"$IMAGE_VER\", \"builddate\":\"$(date +"%Y-%m-%d_%T")\",\"ref_name\":\"$GITHUB_REF\" }" > ./cms/src/lib/ver.json - cat ./cms/src/lib/ver.json - echo '::set-output name=image_ver::'$IMAGE_VER - - name: Debug act - if: ${{ env.ACT }} - run: | - echo $GITHUB_REF - echo ${{ steps.gen_ver.outputs.image_ver }} - cat ./cms/src/lib/ver.json - - name: Login in to registry - uses: docker/login-action@v2 - with: - registry: ${{env.REGISTRY}} - username: ${{secrets.DOCKER_USER}} - password: ${{secrets.DOCKER_PASS}} - - - name: Build and push docker image - uses: docker/build-push-action@v4 - with: - context: cms - load: true - file: docker/Dockerfile - # cache-from: type=gha - # cache-to: type=gha,mode=max - # cache-from: type=local,src=/tmp/.buildx-cache - # cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest - - name: Push image to registry - run: | - docker push ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }} - docker push ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest - - name: Remote Deployment - uses: appleboy/ssh-action@v0.1.8 - with: - host: ${{env.DEPLOY_HOST}} - username: frappet - password: ${{ secrets.SSH_PASSWORD }} - port: 22 - script: | - cd "${{env.COMPOSE_PATH}}" - docker-compose pull - docker-compose up -d - echo "${{ steps.gen_ver.outputs.image_ver }}"> success diff --git a/.github/workflows/local-build.yaml b/.github/workflows/local-build.yaml deleted file mode 100644 index ccd3ce1..0000000 --- a/.github/workflows/local-build.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: local-build -run-name: local-build ${{ github.actor }} -on: - # push: - # tags: - # - v1.** - # branches: - # - 'main' - # branches: - # - 'release-*' - - # Allow run workflow manually from Action tab - workflow_dispatch: - inputs: - IMAGE_VER: - description: "version for build image" - type: string - -env: - REGISTRY: docker.frappet.com - IMAGE_NAME: demo/qualifying-exam-cms - -jobs: - # act workflow_dispatch --reuse -W .github/workflows/local-build.yaml --input IMAGE_VER=v0.2.4-dev - local-image: - runs-on: ubuntu-latest - steps: - - name: Check out code # checkout only cms is possible but I checkout all - uses: actions/checkout@v3 - - name: Gen Version - id: gen_ver - run: | - IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} - echo "{\"version\":\"$IMAGE_VER\", \"builddate\":\"$(date +"%Y-%m-%d_%T")\",\"ref_name\":\"$GITHUB_REF\" }" > ./cms/src/lib/ver.json - cat ./cms/src/lib/ver.json - echo '::set-output name=image_ver::'$IMAGE_VER - - name: Debug act - if: ${{ env.ACT }} - run: | - echo $GITHUB_REF - echo ${{ steps.gen_ver.outputs.image_ver }} - cat ./cms/src/lib/ver.json - - - name: Build and push docker image - uses: docker/build-push-action@v4 - with: - context: cms - load: true - file: docker/Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max - # cache-from: type=local,src=/tmp/.buildx-cache - # cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest