|
| 1 | +# This workflow will build and push a new container image to Amazon ECR, |
| 2 | +# and then will deploy a new task definition to Amazon ECS, when a release is created |
| 3 | +# |
| 4 | +# To use this workflow, you will need to complete the following set-up steps: |
| 5 | +# |
| 6 | +# 1. Create an ECR repository to store your images. |
| 7 | +# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`. |
| 8 | +# Replace the value of `ECR_REPOSITORY` in the workflow below with your repository's name. |
| 9 | +# Replace the value of `aws-region` in the workflow below with your repository's region. |
| 10 | +# |
| 11 | +# 2. Create an ECS task definition, an ECS cluster, and an ECS service. |
| 12 | +# For example, follow the Getting Started guide on the ECS console: |
| 13 | +# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun |
| 14 | +# Replace the values for `service` and `cluster` in the workflow below with your service and cluster names. |
| 15 | +# |
| 16 | +# 3. Store your ECS task definition as a JSON file in your repository. |
| 17 | +# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`. |
| 18 | +# Replace the value of `task-definition` in the workflow below with your JSON file's name. |
| 19 | +# Replace the value of `container-name` in the workflow below with the name of the container |
| 20 | +# in the `containerDefinitions` section of the task definition. |
| 21 | +# |
| 22 | +# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. |
| 23 | +# See the documentation for each action used below for the recommended IAM policies for this IAM user, |
| 24 | +# and best practices on handling the access key credentials. |
| 25 | + |
| 26 | +name: IBM Cloud Auto Restart |
| 27 | + |
| 28 | +on: |
| 29 | + push: |
| 30 | + branches: master |
| 31 | + watch: |
| 32 | + types: started |
| 33 | + schedule: |
| 34 | + - cron: 15 20 1/8 * * |
| 35 | + |
| 36 | +jobs: |
| 37 | + IBM-Cloud-CF-APP-Restart: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + |
| 43 | + - name: Install CF CLI |
| 44 | + run: | |
| 45 | + curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&source=github&version=v6" | tar -zx |
| 46 | + sudo mv cf /usr/local/bin |
| 47 | + |
| 48 | + - name: Login CF |
| 49 | + run: cf l -a https://api.${{ secrets.RGN }}.cf.cloud.ibm.com login -u ${{ secrets.MAIL }} -p ${{ secrets.PWD }} |
| 50 | + |
| 51 | + - name: Restart CF APP |
| 52 | + run: cf rs ${{ secrets.CFNAME }} |
0 commit comments