citra-emu
/
citra-web
Archived
1
0
Fork 0

Transition to GitHub Actions (#136)

* gulpfile.js: fix ESLint warnings

* package.json: add shortcut scripts

* scripts/games: do a shallow git clone to save time

* ci: migrate to GitHub Actions
This commit is contained in:
liushuyu 2020-11-05 00:53:06 -07:00 committed by GitHub
parent 5dc5d4331a
commit 245eaf7448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 88 deletions

44
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Deploy Site
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install dependencies
run: |
echo '========== Installing gulp & dependencies =========='
sudo apt-get install graphicsmagick
wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.52/hugo_0.52_Linux-64bit.deb
sudo dpkg -i hugo.deb
yarn install
# Install dependencies one-by-one to avoid race-conditions
pushd ./scripts/wiki/ && yarn && popd
pushd ./scripts/games/ && yarn && popd
hugo version
- name: Build
env:
TENANT: 'citra'
run: |
echo '========== Starting gulp deploy task =========='
yarn run build
- name: Deploy
if: ${{ (! github.base_ref) && (github.repository == 'citra-emu/citra-web') }}
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_NAME: CitraBotWeb/CitraBotWeb.github.io
BRANCH: master
FOLDER: build
CLEAN: true
SINGLE_COMMIT: true

View File

@ -1,32 +0,0 @@
# Build status located at https://travis-ci.org/citra-emu/citra-web
language: node_js
node_js:
- "lts/erbium"
cache: yarn
script:
- echo '========== Updating Yarn ==========================='
- curl -o- -L https://yarnpkg.com/install.sh | bash
- echo '========== Installing gulp & dependencies =========='
- sudo apt-get install graphicsmagick
- wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.52/hugo_0.52_Linux-64bit.deb
- sudo dpkg -i hugo.deb
- yarn install
- echo '========== Starting gulp deploy task =========='
- hugo version
- yarn run gulp all --production
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
local_dir: build
repo: CitraBotWeb/CitraBotWeb.github.io
target_branch: master
fqdn: citra-emu.org
on:
branch: master
notifications:
email:
- citra@citra-emu.org

View File

@ -1,3 +1,4 @@
/* eslint-disable no-console */
const gulp = require('gulp');
const fs = require('fs');
const util = require('gulp-util');
@ -11,7 +12,7 @@ const concat = require('gulp-concat');
const imageResize = require('gulp-image-resize');
gulp.task('scripts:games', function (callback) {
exec(`cd ./scripts/games/ && yarn install && node app.js`, function (err, stdout, stderr) {
exec('yarn install && node app.js', { cwd: './scripts/games/' }, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
callback(err);
@ -19,7 +20,7 @@ gulp.task('scripts:games', function (callback) {
});
gulp.task('scripts:wiki', function (callback) {
exec(`cd ./scripts/wiki/ && yarn install && node app.js`, function (err, stdout, stderr) {
exec('yarn install && node app.js', { cwd: './scripts/wiki/' }, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
callback(err);
@ -27,23 +28,23 @@ gulp.task('scripts:wiki', function (callback) {
});
gulp.task('assets:images', function() {
var baseImages = gulp.src(`build/images/*`, {base: './'})
var baseImages = gulp.src('build/images/*', {base: './'})
.pipe(gulp.dest('./'));
var jumbotronImages = gulp.src(`build/images/jumbotron/*`, {base: './'})
var jumbotronImages = gulp.src('build/images/jumbotron/*', {base: './'})
.pipe(imageResize({ width: 786, height: 471, crop: true }))
.pipe(gulp.dest('./'));
var bannerImages = gulp.src(`build/images/banners/*`, {base: './'})
var bannerImages = gulp.src('build/images/banners/*', {base: './'})
.pipe(imageResize({ width: 824, height: 306, crop: false }))
.pipe(gulp.dest('./'));
var boxartImages = gulp.src(`build/images/game/boxart/*`, {base: './'})
var boxartImages = gulp.src('build/images/game/boxart/*', {base: './'})
.pipe(imageResize({ width: 328, height: 300, crop: true }))
.pipe(gulp.dest('./'));
var iconImages = gulp.src(`build/images/game/icons/*`, {base: './'})
var iconImages = gulp.src('build/images/game/icons/*', {base: './'})
.pipe(imageResize({ width: 48, height: 48, crop: true }))
.pipe(gulp.dest('./'));
var screenshotImages = gulp.src(`build/images/screenshots/*`)
var screenshotImages = gulp.src('build/images/screenshots/*')
.pipe(imageResize({ width: 400, height: 240, crop: false }))
.pipe(gulp.dest(`build/images/screenshots/thumbs`));
.pipe(gulp.dest('build/images/screenshots/thumbs'));
return merge(baseImages, jumbotronImages, bannerImages, boxartImages, iconImages, screenshotImages);
});
@ -97,8 +98,8 @@ gulp.task('final:serve', function(done) {
});
gulp.task('final:publish', function(done) {
fs.writeFileSync(`build/CNAME`, `${cname}`);
fs.writeFileSync(`build/robots.txt`, `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`);
fs.writeFileSync('build/CNAME', `${cname}`);
fs.writeFileSync('build/robots.txt', `Sitemap: https://${cname}/sitemap.xml\n\nUser-agent: *`);
done();
});

View File

@ -4,6 +4,10 @@
"description": "The Citra Official Website",
"author": "",
"license": "AGPL-3.0-only",
"scripts": {
"build": "gulp all --production",
"serve": "gulp all"
},
"dependencies": {
"bootstrap-sass": "^3.4.1",
"browser-sync": "^2.26.7",

View File

@ -38,7 +38,7 @@ function gitPull(directory, repository) {
} else {
logger.info(`Cloning repository from Github : ${directory}`);
logger.info(`git clone ${repository}`);
exec(`git clone ${repository}`);
exec(`git clone --depth=1 ${repository}`);
}
}