Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for GitHub Actions #250

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
beheh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on: [push]

permissions:
id-token: write
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 10
cache: yarn

- name: Install
run: |
npm install -g gulp webpack yarn
yarn --pure-lockfile

- name: Prettier
run: yarn run lint:prettier

- name: TSLint
continue-on-error: true
run: yarn run lint:tslint

- name: Build
run: yarn run build

deploy:
name: Deploy
needs: [test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/main')
env:
NODE_ENV: production
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 10
cache: yarn
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install
run: |
npm install -g gulp webpack yarn
yarn --pure-lockfile
- name: Build package
run: |
yarn build
if [ ! -f dist/joust.js ]; then >&2 echo "Missing critical file"; exit 1; fi
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::746159132190:role/github-joust-deploy-role
aws-region: us-east-1
- name: Upload to static.hsreplay.net
run: |
aws s3 sync --delete dist/ s3://static.hsreplay.net/joust/
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

75 changes: 0 additions & 75 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const gitDescribe = require("git-describe").gitDescribe;

const download = require("gulp-download");

const Sentry = require("sentry-api").Client;
const fs = require("fs");
const path = require("path");

Expand Down Expand Up @@ -125,80 +124,6 @@ gulp.task("version:write", ["env:set-release"], function() {
return gfile("VERSION", version, { src: true }).pipe(gulp.dest("dist/"));
});

gulp.task("sentry:release", ["env:set-release"], function() {
var version = process.env.JOUST_RELEASE;
var key = "SENTRY_TOKEN";
var token = process.env[key];
if (!token) {
throw Error(
"Sentry Token not found (expected environment variable " +
key +
")",
);
}
var sentry = new Sentry({ token: token });
var prefix = process.env.SENTRY_FILE_PREFIX
? process.env.SENTRY_FILE_PREFIX
: "";

return sentry.releases
.create("hearthsim", "joust", {
version: version,
ref: version,
})
.then(function(release) {
gutil.log(
"Created Sentry release",
gutil.colors.green(release.version),
);

var files = [
"dist/joust.css",
"dist/joust.css.map",
"dist/joust.js",
"dist/joust.js.map",
];
var uploads = files.map(function(file) {
return sentry.releases
.createFile("hearthsim", "joust", version, {
name: prefix + path.basename(file),
file: fs.createReadStream(file),
})
.then(function(newFile) {
gutil.log(
"Uploaded",
gutil.colors.green(newFile.name),
"to Sentry",
);
})
.catch(function(error) {
throw new Error(
"Error uploading file " +
file +
": " +
error.message,
);
});
});

return Promise.all(uploads);
})
.then(function() {
gutil.log("Release successful");
})
.catch(function(error) {
if (error.message === "Release with version already exists") {
gutil.log(
gutil.colors.yellow(
"Warning: Sentry release already exists, skipping upload",
),
);
return;
}
throw new Error("Error creating Sentry release: " + error.message);
});
});

gulp.task("html", ["html:dev"]);

gulp.task("html:dev", function() {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"react-dom": "^16.2.0",
"sax": "^1.2.2",
"screenfull": "^3.1.0",
"sentry-api": "^0.1.1",
"through2": "^2.0.3",
"ts-loader": "^3.5.0",
"typescript": "^2.7.2",
Expand Down
48 changes: 4 additions & 44 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ async@^2.0.0, async@^2.1.2:
dependencies:
lodash "^4.14.0"

async@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/async/-/async-1.0.0.tgz#f8fc04ca3a13784ade9e1641af98578cfbd647a9"

asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
Expand Down Expand Up @@ -1402,10 +1398,6 @@ colormin@^1.0.5:
css-color-names "0.0.4"
has "^1.0.1"

[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"

colors@^1.1.0:
version "1.2.4"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.4.tgz#e0cb41d3e4b20806b3bfc27f4559f01b94bc2f7c"
Expand Down Expand Up @@ -1677,10 +1669,6 @@ custom-event@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425"

[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/cycle/-/cycle-1.0.3.tgz#21e80b2be8580f98b468f379430662b046c34ad2"

d@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
Expand Down Expand Up @@ -2262,10 +2250,6 @@ extsprintf@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"

[email protected]:
version "0.1.8"
resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0"

fancy-log@^1.1.0, fancy-log@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1"
Expand Down Expand Up @@ -3388,7 +3372,7 @@ isomorphic-fetch@^2.1.1:
node-fetch "^1.0.1"
whatwg-fetch ">=0.10.0"

isstream@0.1.x, isstream@~0.1.2:
isstream@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"

Expand Down Expand Up @@ -3892,7 +3876,7 @@ lodash.values@~2.4.1:
dependencies:
lodash.keys "~2.4.1"

lodash@^3.10.1, lodash@^3.8.0:
lodash@^3.8.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"

Expand Down Expand Up @@ -5038,7 +5022,7 @@ progress@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"

promise@^7.0.4, promise@^7.1.1:
promise@^7.1.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
dependencies:
Expand Down Expand Up @@ -5406,7 +5390,7 @@ [email protected]:
tunnel-agent "^0.6.0"
uuid "^3.0.0"

request@^2.45.0, request@^2.65.0, request@^2.81.0, request@latest:
request@^2.45.0, request@^2.81.0, request@latest:
version "2.85.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa"
dependencies:
Expand Down Expand Up @@ -5523,15 +5507,6 @@ semver@^4.1.0, semver@~4.3.3:
version "4.3.6"
resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da"

sentry-api@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/sentry-api/-/sentry-api-0.1.1.tgz#28f6aefeed61432cbdfdda3d9626559a3e779226"
dependencies:
lodash "^3.10.1"
promise "^7.0.4"
request "^2.65.0"
winston "^2.1.0"

sequencify@~0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c"
Expand Down Expand Up @@ -5800,10 +5775,6 @@ sshpk@^1.7.0:
jsbn "~0.1.0"
tweetnacl "~0.14.0"

[email protected]:
version "0.0.10"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"

static-extend@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6"
Expand Down Expand Up @@ -6523,17 +6494,6 @@ [email protected]:
version "0.1.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"

winston@^2.1.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/winston/-/winston-2.4.2.tgz#3ca01f763116fc48db61053b7544e750431f8db0"
dependencies:
async "~1.0.0"
colors "1.0.x"
cycle "1.0.x"
eyes "0.1.x"
isstream "0.1.x"
stack-trace "0.0.x"

[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
Expand Down
Loading