Skip to content

Commit 8dcd3b0

Browse files
authored
Merge pull request #159 from getsentry/ryan953/gh-actions-deploy
wip: Deploy with GH Actions
2 parents 6e9bcf0 + b5ee061 commit 8dcd3b0

File tree

12 files changed

+98
-53
lines changed

12 files changed

+98
-53
lines changed

.travis/sentry-release.sh renamed to .github/sentry-release.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@ if [ "${SENTRY_AUTH_TOKEN}" != "" ]; then
66
SENTRY_AUTH_TOKEN_PUBLIC="<hidden>"
77
fi
88

9-
if [ -z "${TRAVIS_COMMIT}" ]; then
10-
TRAVIS_COMMIT=`git rev-parse HEAD`
9+
if [ -z "${GITHUB_SHA}" ]; then
10+
GITHUB_SHA=$(git rev-parse HEAD)
1111
fi
1212

1313
echo "SENTRY_ORG: ${SENTRY_ORG}"
1414
echo "SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN_PUBLIC}"
15-
echo "SENTRY_SERVER_PROJECT: ${SENTRY_SERVER_PROJECT}"
1615
echo "SENTRY_CLIENT_PROJECT: ${SENTRY_CLIENT_PROJECT}"
1716
echo "SOURCEMAPSIO_REPO: ${SOURCEMAPSIO_REPO}"
18-
echo "TRAVIS_COMMIT: ${TRAVIS_COMMIT}"
17+
echo "GITHUB_SHA: ${GITHUB_SHA}"
1918

2019
curl https://sentry.io/api/0/organizations/${SENTRY_ORG}/releases/ \
2120
-X POST \
2221
-H "Authorization: Bearer ${SENTRY_AUTH_TOKEN}" \
2322
-H 'Content-Type: application/json' \
2423
-d "
2524
{
26-
\"version\": \"${TRAVIS_COMMIT}\",
25+
\"version\": \"${GITHUB_SHA}\",
2726
\"refs\": [{
2827
\"repository\":\"${SOURCEMAPSIO_REPO}\",
29-
\"commit\":\"${TRAVIS_COMMIT}\"
28+
\"commit\":\"${GITHUB_SHA}\"
3029
}],
31-
\"projects\":[\"${SENTRY_SERVER_PROJECT}\", \"${SENTRY_CLIENT_PROJECT}\"]
32-
}"
30+
\"projects\":[\"${SENTRY_CLIENT_PROJECT}\"]
31+
}"

.github/workflows/deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: deploy & test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
env:
10+
NODE_OPTIONS: '--max-old-space-size=4096 --openssl-legacy-provider'
11+
12+
jobs:
13+
test:
14+
runs-on: 'ubuntu-latest'
15+
steps:
16+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
17+
- run: make test
18+
19+
deploy:
20+
# needs: test
21+
# if: github.ref == 'refs/heads/master'
22+
runs-on: 'ubuntu-latest'
23+
environment: 'gcp - project=sourcemapsio'
24+
steps:
25+
- id: setup-gcloud
26+
name: 'Setup gcloud'
27+
uses: 'google-github-actions/setup-gcloud@v2'
28+
with:
29+
version: '>= 400.0.0'
30+
31+
- id: auth-gcloud
32+
name: 'Auth gcloud'
33+
env:
34+
SERVICE_KEY_BASE64: ${{ secrets.GCLOUD_SERVICE_KEY }}
35+
run: |
36+
echo $SERVICE_KEY_BASE64 | base64 --decode > service-key.json
37+
gcloud auth activate-service-account --key-file service-key.json
38+
39+
- id: checkout
40+
name: Checkout
41+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
42+
43+
- id: deploy
44+
name: 'Deploy to GCP Cloud Functions'
45+
env:
46+
GCLOUD_APP_BUCKET: ${{ secrets.GCLOUD_APP_BUCKET }}
47+
GCLOUD_DATA_BUCKET: ${{ secrets.GCLOUD_DATA_BUCKET }}
48+
GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT }}
49+
GCLOUD_WWW_BUCKET: ${{ secrets.GCLOUD_WWW_BUCKET }}
50+
REACT_APP_SENTRY_DSN: ${{ vars.REACT_APP_SENTRY_DSN }}
51+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
52+
SENTRY_CLIENT_PROJECT: ${{ secrets.SENTRY_CLIENT_PROJECT }}
53+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
54+
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
55+
run: |
56+
make deploy
57+
.github/sentry-release.sh

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.travis/credentials.tar.gz.enc

-1.97 KB
Binary file not shown.

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ test: test-install
2222
npm test
2323

2424
test-install: echo-exports
25-
npm install
26-
npm install --prefix ./server
27-
npm install --prefix ./client
25+
npm install --legacy-peer-deps
26+
npm install --legacy-peer-deps --prefix ./server
27+
npm install --legacy-peer-deps --prefix ./client
2828

2929
# Launch a local development server for working on the
3030
# React www app (points at deployed/production validation fn)
@@ -73,8 +73,12 @@ deploy-data: deploy-config
7373
deploy-server: deploy-config
7474
npm install --prefix ./server
7575
npm run build
76-
gcloud functions deploy ${GCLOUD_FN_NAME} --source server \
77-
--stage-bucket ${GCLOUD_APP_BUCKET} --trigger-http --verbosity debug
76+
gcloud functions deploy ${GCLOUD_FN_NAME} \
77+
--source server \
78+
--stage-bucket ${GCLOUD_APP_BUCKET} \
79+
--trigger-http \
80+
--verbosity debug \
81+
--runtime nodejs18
7882

7983
# Deploy all
8084
deploy: build-www deploy-config deploy-server deploy-data deploy-www

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# sourcemaps.io [![Build Status](https://travis-ci.org/getsentry/sourcemaps.io.svg?branch=master)](https://travis-ci.org/getsentry/sourcemaps.io)
1+
# sourcemaps.io [![deploy & test](https://github.com/getsentry/sourcemaps.io/actions/workflows/deploy.yml/badge.svg)](https://github.com/getsentry/sourcemaps.io/actions/workflows/deploy.yml)
22

33
_A re-write of [sourcemap-validator](https://github.com/mattrobenolt/sourcemap-validator) using React, Node, and Google Cloud Functions._
44

@@ -73,10 +73,22 @@ gcloud auth login
7373
Then initiate the deploy:
7474

7575
```bash
76+
# Used for deploy
7677
export GCLOUD_PROJECT=myproject
7778
export GCLOUD_APP_BUCKET=myproject-server
7879
export GCLOUD_DATA_BUCKET=myproject-reports
7980
export GCLOUD_WWW_BUCKET=myproject-web
81+
export GCLOUD_SERVICE_KEY=<base64 encoded service-key json object>
82+
83+
# Used for reporting errors back to your sentry instance:
84+
export REACT_APP_SENTRY_DSN=https://public@sentry.example.com/1
85+
export SENTRY_DSN=https://public@sentry.example.com/1
86+
87+
# Used for creating a new release in your sentry instance:
88+
export SENTRY_AUTH_TOKEN=sntrys_abcxyz
89+
export SENTRY_CLIENT_PROJECT=MY-PROJECT
90+
export SENTRY_ORG=MY-ORG
91+
8092
make deploy
8193
```
8294

client/package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
]
3737
},
3838
"engines": {
39-
"node": "16.14.2"
39+
"node": "18.19.1",
40+
"npm": "10.2.4"
4041
},
4142
"volta": {
4243
"node": "16.14.2",

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"singleQuote": true
3030
},
3131
"engines": {
32-
"node": "16.14.2"
32+
"node": "18.19.1",
33+
"npm": "10.2.4"
3334
},
3435
"volta": {
3536
"node": "16.14.2",

0 commit comments

Comments
 (0)