From e8c379030493f7d1d5f689f49dba846fffbd51e7 Mon Sep 17 00:00:00 2001 From: Sam Ken <100836531+samkenxstream@users.noreply.github.com> Date: Wed, 8 Mar 2023 14:42:40 +0800 Subject: [PATCH] Create .github/workflows/deploy.yml --- .github/workflows/deploy.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..7875d92be2 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: deploy +on: + push: + branches: + - deploy-staging + - deploy-production + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set staging variables + run: | + echo "ENVIRONMENT_URL=https://your_service.npm.red" >> $GITHUB_ENV + echo "DEPLOYMENT_CONFIDENCE_URL=${{ secrets.DATADOG_STAGING_DEPLOYMENT_DASHBOARD_URL }}" >> $GITHUB_ENV + if: github.ref == 'refs/heads/deploy-staging' + + - name: Set production variables + run: | + echo "ENVIRONMENT_URL=https://your_service.internal.npmjs.com" >> $GITHUB_ENV + echo "DEPLOYMENT_CONFIDENCE_URL=${{ secrets.DATADOG_PRODUCTION_DEPLOYMENT_DASHBOARD_URL }}" >> $GITHUB_ENV + if: github.ref == 'refs/heads/deploy-production' + + - name: create a deployment + uses: npm/action-deploy@v2 + with: + type: create + token: ${{github.token}} + logs: https://github.slack.com/archives/C02UYAZ5P # npm-deploys channel + environment_url: ${{env.ENVIRONMENT_URL}} + deployment_confidence_url: ${{env.DEPLOYMENT_CONFIDENCE_URL}} + job_status: ${{job.status}} # keep that to track status of the current job, when deployment is completed + slack_token: ${{secrets.NPM_ROBOT_SLACK_TOKEN}} + slack_channel: npm-ops + + # change to actual deployment steps + - name: placeholder for actual deployment + run: sleep 10s