Skip to content

Instantly share code, notes, and snippets.

@SpiritLing

SpiritLing/.travis.yml Secret

Last active Dec 18, 2019
Embed
What would you like to do?
language: node_js
services:
- docker
node_js:
- 12
jobs:
include:
- stage: master
name: "master"
if: branch = master
script:
- npm install -g hexo
- hexo clean
- hexo generate
- git remote -v
- git tag
- VERSION=$(node ./source/scripts/auto-versioning.js)
- echo $VERSION
- git tag -a -f v$VERSION -m "Travis CI Auto Tag `date +"%Y-%m-%d %H:%M:%S"`"
- git push -f https://${GITHUB_USERNAME}:${GITHUB_PASSWD}@github.com/SpiritLing/blog.git v$VERSION
- git checkout --orphan gh-pages
- git config user.name "Travis CI"
- git branch -v -a
- git rm --cached -r -f .
- rm -rf `ls | grep -v public`
- cp -r ./public/* .
- rm -rf ./public
- git add -f .
- git commit -m "Travis CI Auto Release `date +"%Y-%m-%d %H:%M:%S"`"
- git push -f https://${GITHUB_USERNAME}:${GITHUB_PASSWD}@github.com/SpiritLing/blog.git
- stage: dev
name: "dev"
if: branch = dev
script:
- npm install -g hexo
- mv -f _config.dev.yml _config.yml
- hexo clean
- hexo generate
- git remote -v
- git tag
- VERSION=$(node ./source/scripts/auto-versioning.js)
- echo $VERSION
- git tag -a -f v$VERSION -m "Travis CI Auto Tag `date +"%Y-%m-%d %H:%M:%S"`"
- git push -f https://${CODING_USERNAME}:${CODING_PASSWD}@e.coding.net/spiritling/dev.git v$VERSION
- git checkout --orphan dev-blog
- git config user.name "Travis CI"
- git branch -v -a
- git rm --cached -r -f .
- rm -rf `ls | grep -v public`
- cp -r ./public/* .
- rm -rf ./public
- git add -f .
- git commit -m "Travis CI Auto Release `date +"%Y-%m-%d %H:%M:%S"`"
- git push -f https://${CODING_USERNAME}:${CODING_PASSWD}@e.coding.net/spiritling/dev.git
- docker login -u ${DOCKER_USERNAME} --password ${DOCKER_PASSWD}
- docker build -t ${DOCKER_RPO}:latest .
- docker push ${DOCKER_RPO}
notifications:
email:
recipients:
- ling_dark_portal@163.com
on_success: never # default: change
on_failure: always # default: always
const path = require('path');
const semver = require('semver');
function getPackageVersion() {
const packageJson = path.join(process.cwd(), 'package.json');
let version;
try {
version = require(packageJson).version;
} catch (unused) {
throw new Error('Could not load package.json, please make sure it exists');
}
if (!semver.valid(version)) {
throw new Error('Invalid version number found in package.json, please make sure it is valid');
}
return [semver.major(version), semver.minor(version), semver.patch(version)].join('.');
}
console.log(getPackageVersion());
FROM nginx
COPY ./config/nginx.conf /etc/nginx/conf.d/default.conf
COPY . /usr/share/nginx/html/
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 404 500 502 503 504 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /404.html;
# location = /50x.html {
# root /usr/share/nginx/html;
# }
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.