add plausible, replace circleci with github workflows

This commit is contained in:
Dawid Wysokiński 2021-11-14 10:00:13 +01:00
parent 1f7cbb6f94
commit b7a45f8c2a
Signed by: Kichiyaki
GPG Key ID: EF14026D247EB867
6 changed files with 85 additions and 38 deletions

View File

@ -1,29 +0,0 @@
version: 2
jobs:
build:
docker:
- image: circleci/node:14.18.0-browsers
working_directory: ~/twhelpdcbotwebsite
steps:
- checkout
- setup_remote_docker:
version: 20.10.2
# start proprietary DB using private Docker image
# with credentials stored in the UI
- run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/twhelp-dcbot-website:latest .
# deploy the image
- run: docker push $DOCKER_LOGIN/twhelp-dcbot-website:latest
workflows:
version: 2
deploy_prod:
jobs:
- build:
context: TWHelp
filters:
branches:
only:
- master

48
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Build and push to registry
on:
push:
tags:
- '*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
build-args: |
PLAUSIBLE_CUSTOM_DOMAIN=${{ secrets.PLAUSIBLE_CUSTOM_DOMAIN }}
VERSION=${{ steps.get_version.outputs.VERSION }}
tags: |
${{ secrets.REGISTRY_NAME }}/twhelp-dcbot-website:latest
${{ secrets.REGISTRY_NAME }}/twhelp-dcbot-website:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile
push: true

View File

@ -1,8 +1,10 @@
FROM node:14.18.0-alpine as build-deps
FROM node:14.18.1-alpine as build-deps
ENV NODE_ENV=production
ARG PLAUSIBLE_CUSTOM_DOMAIN=""
ENV PLAUSIBLE_CUSTOM_DOMAIN=$PLAUSIBLE_CUSTOM_DOMAIN \
NODE_ENV=production
#Stage 1
RUN apk --no-cache add shadow \
gcc \
musl-dev \
@ -17,14 +19,15 @@ RUN apk --no-cache add shadow \
zlib-dev \
file \
pkgconf
RUN npm install --global gatsby-cli@3.3.0
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn global add gatsby-cli@3.3.0
RUN yarn
COPY . ./
RUN yarn build
#Stage 2
FROM nginx:1.21-alpine
COPY --from=build-deps /usr/src/app/public /var/www
COPY default.conf /etc/nginx/templates/default.conf.template

View File

@ -1,10 +1,11 @@
const siteUrl = 'https://dcbot.tribalwarshelp.com';
const DOMAIN = 'dcbot.tribalwarshelp.com';
const SITE_URL = 'https://' + DOMAIN;
module.exports = {
siteMetadata: {
title: `TWHelp Discord Bot`,
description: `Discord bot for online game Tribalwars. | Real-time notifications about conquered/lost villages.`,
siteUrl,
siteUrl: SITE_URL,
twhelpUrl: 'https://tribalwarshelp.com',
botInviteUrl:
'https://discord.com/oauth2/authorize?client_id=707859810900508703&scope=bot&permissions=8',
@ -53,8 +54,8 @@ module.exports = {
{
resolve: 'gatsby-plugin-robots-txt',
options: {
host: siteUrl,
sitemap: siteUrl + '/sitemap.xml',
host: SITE_URL,
sitemap: SITE_URL + '/sitemap.xml',
env: {
development: {
policy: [{ userAgent: '*', disallow: ['/'] }],
@ -74,5 +75,12 @@ module.exports = {
prefixDefault: false,
},
},
{
resolve: `@kichiyaki/gatsby-plugin-plausible`,
options: {
domain: DOMAIN,
customDomain: process.env.PLAUSIBLE_CUSTOM_DOMAIN,
},
},
],
};

View File

@ -5,6 +5,7 @@
"version": "0.1.0",
"author": "Dawid Wysokiński <xyztojajestem@gmail.com>",
"dependencies": {
"@kichiyaki/gatsby-plugin-plausible": "^0.0.8",
"@kichiyaki/roboto": "^1.0.0",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",

View File

@ -969,6 +969,13 @@
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.9.2":
version "7.16.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.3.tgz#b86f0db02a04187a3c17caa77de69840165d42d5"
integrity sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ==
dependencies:
regenerator-runtime "^0.13.4"
"@babel/standalone@^7.12.6":
version "7.13.17"
resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.13.17.tgz#921b82a11a80ce824589516736d629efc53297aa"
@ -1535,6 +1542,15 @@
"@babel/runtime" "^7.7.2"
regenerator-runtime "^0.13.3"
"@kichiyaki/gatsby-plugin-plausible@^0.0.8":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@kichiyaki/gatsby-plugin-plausible/-/gatsby-plugin-plausible-0.0.8.tgz#94f53c5a8f768b934228e4f43c5493c38885152b"
integrity sha512-DO03Z6NHRiwh8XHJtBJcLxMZ1a8cDjYM0inuGmNI33ea7fV4wdGVF5uHidlbdlls2hLfYPDkjOc0y2Yz3Ff/nw==
dependencies:
"@babel/runtime" "^7.9.2"
minimatch "3.0.4"
react "^17.0.2"
"@kichiyaki/roboto@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@kichiyaki/roboto/-/roboto-1.0.0.tgz#6f5dfb40e2423940588946c952490b123ca8088b"
@ -10860,7 +10876,7 @@ react-transition-group@^4.4.0:
loose-envify "^1.4.0"
prop-types "^15.6.2"
react@^17.0.0:
react@^17.0.0, react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==