|
| 1 | +# name: Build and Deploy |
| 2 | + |
| 3 | +# on: |
| 4 | +# workflow_call: |
| 5 | +# inputs: |
| 6 | +# environment: |
| 7 | +# description: "Environment name" |
| 8 | +# required: true |
| 9 | +# type: string |
| 10 | +# containerNamespaceID: |
| 11 | +# description: "ScaleWay Container Namespace" |
| 12 | +# required: true |
| 13 | +# type: string |
| 14 | +# region: |
| 15 | +# description: "region name" |
| 16 | +# required: true |
| 17 | +# type: string |
| 18 | +# default: "fr-par" |
| 19 | +# projectId: |
| 20 | +# description: "project ID" |
| 21 | +# required: false |
| 22 | +# type: string |
| 23 | +# default: "" |
| 24 | +# appName: |
| 25 | +# description: "Application Name" |
| 26 | +# required: true |
| 27 | +# type: string |
| 28 | + |
| 29 | +# jobs: |
| 30 | +# notify-start: |
| 31 | +# runs-on: ubuntu-latest |
| 32 | +# steps: |
| 33 | +# - name: Notify start on Slack |
| 34 | +# uses: rtCamp/action-slack-notify@v2 |
| 35 | +# env: |
| 36 | +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 37 | +# SLACK_MESSAGE: "Deployment to Scaleway Containers started! :eyes:" |
| 38 | +# SLACK_USERNAME: "Automation" |
| 39 | +# SLACK_ICON: ":rocket:" |
| 40 | + |
| 41 | +# build-and-push: |
| 42 | +# name: Build and Push Docker Image |
| 43 | +# runs-on: ubuntu-latest |
| 44 | +# environment: ${{ inputs.environment }} |
| 45 | +# env: |
| 46 | +# REGION: ${{ inputs.region }} |
| 47 | +# REPOSITORY: rg.${{ inputs.region }}.scw.cloud/${{ inputs.appName }} |
| 48 | +# NAMESPACE: ${{ inputs.containerNamespaceID }} |
| 49 | +# PROJECT_ID: ${{ inputs.projectId }} |
| 50 | +# APP_NAME: ${{ inputs.appName }} |
| 51 | + |
| 52 | +# steps: |
| 53 | +# - name: Checkout code |
| 54 | +# uses: actions/checkout@v2 |
| 55 | +# - name: Overwrite .env file with .env.container |
| 56 | +# run: cp .env.container .env |
| 57 | +# - name: Login to Scaleway Container Registry |
| 58 | +# uses: docker/login-action@v3 |
| 59 | +# with: |
| 60 | +# username: nologin |
| 61 | +# password: ${{ secrets.SCW_SECRET_KEY }} |
| 62 | +# registry: ${{ env.REPOSITORY }} |
| 63 | +# - name: Build the Docker image |
| 64 | +# run: docker build . -t ${{ env.REPOSITORY }}/dtb:latest |
| 65 | +# - name: Push the Docker Image |
| 66 | +# run: docker push ${{ env.REPOSITORY }}/dtb:latest |
| 67 | + |
| 68 | + |
| 69 | +# deploy: |
| 70 | +# runs-on: ubuntu-latest |
| 71 | +# name: Deploy on Scaleway Containers |
| 72 | +# needs: build-and-push |
| 73 | +# environment: ${{ inputs.environment }} |
| 74 | +# env: |
| 75 | +# REGION: ${{ inputs.region }} |
| 76 | +# REPOSITORY: rg.${{ inputs.region }}.scw.cloud/${{ inputs.appName }} |
| 77 | +# NAMESPACE: ${{ inputs.containerNamespaceID }} |
| 78 | +# PROJECT_ID: ${{ inputs.projectId }} |
| 79 | +# APP_NAME: ${{ inputs.appName }} |
| 80 | +# steps: |
| 81 | +# - name: Checkout |
| 82 | +# uses: actions/checkout@v3 |
| 83 | +# - name: Scaleway Container Deploy action |
| 84 | +# id: deploy |
| 85 | +# uses: philibea/[email protected] |
| 86 | +# with: |
| 87 | +# type: deploy |
| 88 | +# scw_access_key: ${{ secrets.SCW_ACCESS_KEY }} |
| 89 | +# scw_secret_key: ${{ secrets.SCW_SECRET_KEY }} |
| 90 | +# scw_containers_namespace_id: ${{ env.NAMESPACE }} |
| 91 | +# scw_container_port: 3000 |
| 92 | +# scw_registry: ${{ env.REPOSITORY }}/dtb:latest |
| 93 | + |
| 94 | +# notify-success: |
| 95 | +# runs-on: ubuntu-latest |
| 96 | +# needs: [build-and-push, deploy] |
| 97 | +# if: success() |
| 98 | +# steps: |
| 99 | +# - name: Notify success on Slack |
| 100 | +# uses: rtCamp/action-slack-notify@v2 |
| 101 | +# env: |
| 102 | +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 103 | +# SLACK_MESSAGE: "Deployment to Scaleway Containers was successful! :tada:" |
| 104 | +# SLACK_USERNAME: "Automation" |
| 105 | +# SLACK_ICON: ":rocket:" |
| 106 | + |
| 107 | +# notify-failure: |
| 108 | +# runs-on: ubuntu-latest |
| 109 | +# needs: [build-and-push, deploy] |
| 110 | +# if: failure() |
| 111 | +# steps: |
| 112 | +# - name: Notify failure on Slack |
| 113 | +# uses: rtCamp/action-slack-notify@v2 |
| 114 | +# env: |
| 115 | +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 116 | +# SLACK_MESSAGE: "Deployment to Scaleway Containers failed! :x:" |
| 117 | +# SLACK_USERNAME: "Automation" |
| 118 | +# SLACK_ICON: ":warning:" |
| 119 | + |
0 commit comments