From 0f787e4eeb1946592b8ea2d3b39a675de5c2577a Mon Sep 17 00:00:00 2001 From: Jason Jackson Date: Thu, 14 Mar 2024 18:23:06 -0400 Subject: [PATCH] Convert to Actions --- .github/workflows/build-and-publish.yml | 40 +++++++++++++++++++++++++ README.md | 2 +- action-services.yml | 10 +++++++ codeship-services.yml | 6 ---- codeship-steps.yml | 21 ------------- dockercfg.encrypted | 2 -- 6 files changed, 51 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/build-and-publish.yml create mode 100644 action-services.yml delete mode 100644 codeship-services.yml delete mode 100644 codeship-steps.yml delete mode 100644 dockercfg.encrypted diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..02fe580 --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,40 @@ +name: Build and Publish + +on: + push: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run tests + run: docker-compose -f action-services.yml run test + + build-and-publish: + name: Build and Publish + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ vars.DOCKER_ORG }}/ecs-deploy + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/README.md b/README.md index b44564d..26bab16 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ecs-deploy ================= -[ ![Codeship Status for silinternational/ecs-deploy](https://app.codeship.com/projects/393a91e0-da8d-0134-6603-1e487e818871/status?branch=master)](https://app.codeship.com/projects/203720) +![Status for silinternational/ecs-deploy](https://github.com/silinternational/ecs-deploy/actions/workflows/build-and-deploy.yml/badge.svg?branch=master) This script uses the Task Definition and Service entities in Amazon's ECS to instigate an automatic blue/green deployment. diff --git a/action-services.yml b/action-services.yml new file mode 100644 index 0000000..9db03e3 --- /dev/null +++ b/action-services.yml @@ -0,0 +1,10 @@ +version: "2" + +services: + test: + build: . + command: ["/run-tests.sh"] + volumes: + - ./ecs-deploy:/ecs-deploy + - ./run-tests.sh:/run-tests.sh + - ./test.bats:/test.bats diff --git a/codeship-services.yml b/codeship-services.yml deleted file mode 100644 index ebe2c33..0000000 --- a/codeship-services.yml +++ /dev/null @@ -1,6 +0,0 @@ -ecsdeploy: - build: - image: silintl/ecs-deploy - dockerfile_path: ./Dockerfile - entrypoint: bash - command: /run-tests.sh diff --git a/codeship-steps.yml b/codeship-steps.yml deleted file mode 100644 index f3ff14f..0000000 --- a/codeship-steps.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: test - service: ecsdeploy - command: /run-tests.sh - -- name: push_branch_tag - service: ecsdeploy - type: push - image_name: silintl/ecs-deploy - image_tag: "{{.Branch}}" - exclude: master - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted - -- name: push_latest_tag - service: ecsdeploy - type: push - image_name: silintl/ecs-deploy - image_tag: "latest" - tag: master - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted diff --git a/dockercfg.encrypted b/dockercfg.encrypted deleted file mode 100644 index 9b7a03f..0000000 --- a/dockercfg.encrypted +++ /dev/null @@ -1,2 +0,0 @@ -cloudbees:v1 -zDdKfbfu3yVguuUU1hjCG4LSaACQUEDI8BUCwWzqIKnAA+XS3GqqIZMlTPP0BphleYDj9QKaVJOmJvyUi9hxhVZQ1LtHMDE0t3+Ab6d13tAVVOnKyTYOnSid4Joh4Thq24xWbwew4qCrJL6kn+5OtXKg0b5CTXFwlP5nKPq6KuAVY/nxRmRlXlj6rIbB2zO4mnUC/48kgow8TZ634kitNjTp0s0G1/ywjD1OtUr9CD9Xf8DDFwxOfXNQqQM3BEjkcJe8N9u0JtI4aqAcL+TychvJEFwCiQwiO9a7Y85Fd/IxIoseLTObCTTv2O8H \ No newline at end of file