forked from GoogleCloudPlatform/community
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sam Ken <[email protected]>
- Loading branch information
1 parent
ec46a43
commit 1e7f91b
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
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 | ||
- name: Upload a Build Artifact | ||
|
||
uses: actions/[email protected] | ||
|
||
with: | ||
|
||
# Artifact name | ||
|
||
name: # optional, default is artifact | ||
|
||
# A file, directory or wildcard pattern that describes what to upload | ||
|
||
path: | ||
|
||
# The desired behavior if no files are found using the provided path. | ||
|
||
Available Options: | ||
|
||
warn: Output a warning but do not fail the action | ||
|
||
error: Fail the action with an error message | ||
|
||
ignore: Do not output any warnings or errors, the action does not fail | ||
|
||
if-no-files-found: # optional, default is warn | ||
|
||
# Duration after which artifact will expire in days. 0 means using default retention. | ||
|
||
Minimum 1 day. Maximum 90 days unless changed from the repository settings page. | ||
|
||
retention-days: # optional |