Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Sep 10, 2022
2 parents 779e4a9 + 76baf60 commit 7c29dc1
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 168 deletions.
23 changes: 23 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
inputs:
stage:
description: 'Deployment stage'
default: 'stage'
ssh_private_key:
description: 'Private SSH key'
default: ''
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ inputs.ssh_private_key }}
- name: Install Ruby with Bundle to deploy via Capistrano
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true
- name: Execute the deployment
run: bundle exec cap ${{ inputs.stage }} deploy
shell: bash
68 changes: 35 additions & 33 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
name: Continuous Deployment
on: [push]

env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1

jobs:
deploy:
name: Deploy
if:
contains('
refs/heads/master
refs/heads/dev
', github.ref)
runs-on: ubuntu-latest
env:
PRIVATE_SSH_KEY: ${{ secrets.PRIVATE_SSH_KEY }}
steps:
- name: Set deployment environment variables based on Git branches
working-directory: ./
id: deploy_target
run: |
if [[ $GITHUB_REF == 'refs/heads/dev' ]]; then
echo "::set-output name=DEPLOY_ENV::staging"
fi
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
echo "::set-output name=DEPLOY_ENV::production"
fi
- uses: actions/[email protected]
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.PRIVATE_SSH_KEY }}
- name: Install Ruby with Bundle to deploy via Capistrano
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true
- name: Execute the deployment
run: bundle exec cap ${{ steps.deploy_target.outputs.DEPLOY_ENV }} deploy
deploy_prod:
name: Deploy to Production
environment:
name: Production
url: https://swissgames.garden
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
env:
PRIVATE_SSH_KEY: ${{ secrets.PRIVATE_SSH_KEY }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/deploy
with:
stage: production
ssh_private_key: ${{ secrets.PRIVATE_SSH_KEY }}

deploy_staging:
name: Deploy to Staging
environment:
name: Staging
url: https://staging.swissgames.garden
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
env:
PRIVATE_SSH_KEY: ${{ secrets.PRIVATE_SSH_KEY }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/deploy
with:
stage: staging
ssh_private_key: ${{ secrets.PRIVATE_SSH_KEY }}
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.1] - 2022-09-10
### Changed
- rework the deployment using Github environements
- remove \[ & ] from the mailto subject of game udpate btn - Games-of-Switzerland/swissgamesgarden#88

### Added
- add no-index robots.txt on staging only - #102
- add missing Stores links on Games detail - Games-of-Switzerland/swissgamesgarden#46
- allow link to be button - Games-of-Switzerland/swissgamesgarden#9
- add Cantons filters - Games-of-Switzerland/swissgamesgarden#51
- add filter cantons - Games-of-Switzerland/swissgamesgarden#51
- add cantons listing on game detail - Games-of-Switzerland/swissgamesgarden#51

### Fixed
- add & fix missing translations strings for filters
- fix footnote link visual glitch - Games-of-Switzerland/swissgamesgarden#9
- fix about page links people - Games-of-Switzerland/swissgamesgarden#9
- fix empty state games - Games-of-Switzerland/swissgamesgarden#28
- fix the members of games visual - Games-of-Switzerland/swissgamesgarden#98

## [0.1.0] - 2022-09-08
### Changed
- update the hosts strategy to be compliante with new Docker container naming architecture

### Added
- update changelog following 'keep a changelog'

[Unreleased]: https://github.com/Games-of-Switzerland/gos-website/compare/0.1.0...HEAD
[Unreleased]: https://github.com/Games-of-Switzerland/gos-website/compare/0.1.1...HEAD
[0.1.1]: https://github.com/Games-of-Switzerland/gos-website/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/Games-of-Switzerland/gos-website/releases/tag/0.1.0
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1.3

FROM node:14-alpine

# Create app directory
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
3 changes: 3 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# set a branch for this release
set :branch, 'dev'

# Add robots no-follow to staging.
append :linked_files, "public/robots.txt"

# Map docker and docker-compose commands
# NOTE: If stage have different deploy_to
# you have to copy those line for each <stage_name>.rb
Expand Down
4 changes: 2 additions & 2 deletions src/api/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getGame = async ({queryKey}) => {
},
fields: {
'node--game':
'title,body,genres,studios,genres,releases_normalized,release_platforms,website,locations,publishers,sponsors,social_networks,languages,awards,credits,completeness,members,images,contextual_links,sources,article_links',
'title,body,genres,studios,genres,stores,releases_normalized,release_platforms,website,locations,cantons,publishers,sponsors,social_networks,languages,awards,credits,completeness,members,images,contextual_links,sources,article_links',
studios: 'title',
'node--studio': 'title,field_path',
'node--people': 'title,field_path',
Expand All @@ -23,7 +23,7 @@ export const getGame = async ({queryKey}) => {
'taxonomy_term--member': 'name',
},
include:
'studios,release_platforms,genres,locations,publishers,sponsors,languages,members,images',
'studios,release_platforms,genres,locations,cantons,publishers,sponsors,languages,members,images',
});

// console.log(`%cnode query: /node/game?${queryUrl}`, 'font-weight:bold;');
Expand Down
8 changes: 6 additions & 2 deletions src/api/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const options = {
keepPreviousData: true,
select: data => ({
...data,
total: data.pages?.[0].hits.total,
facets: data.pages?.[0].aggregations.aggs_all || {},
total: data?.pages?.[0].hits?.total || 0,
facets: data?.pages?.[0].aggregations?.aggs_all || {},
}),
};

Expand All @@ -30,6 +30,10 @@ export const fetchGames = async ({queryKey: [, value], pageParam}) => {
// Get games from server
const data = await fetchApi(queryUrl);

if (typeof data.errors != "undefined") {
return data;
}

// Set next page index for next call
const hasNextPage = data.hits.total > data.hits.hits.length * (pageParam + 1);
data.page = pageParam;
Expand Down
14 changes: 13 additions & 1 deletion src/components/Game/Detail/GameDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const GameDetail = ({game}) => {
const {
title,
studios,
stores,
genres,
body,
releases_normalized: releases,
Expand Down Expand Up @@ -132,7 +133,18 @@ const GameDetail = ({game}) => {
</div>
)}

{/* TODO add links to download game */}
{/* STORES LINKS */}
<ol className="flex mb-10 space-x-2">
{stores?.map((store, i) => (
<ul>
<Link href={store.link} key={i}>
<a className="btn border text-md py-3 font-semibold border-gray-850 hover:border-gray-500" target="_blank">
{t(`stores.${store.store}`)}
</a>
</Link>
</ul>
))}
</ol>
</div>

{/* IMAGES */}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Game/Detail/Info/GameInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';

const GameInfo = ({title, children}) =>
const GameInfo = ({title, children, childrenClass}) =>
children ? (
<div>
<h3 className="text-md font-light text-gray-500 mb-1">{title}</h3>
<div className="text-lg">{children}</div>
<div className={`text-lg ${childrenClass}`}>{children}</div>
</div>
) : null;

GameInfo.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node,
childrenClass: PropTypes.string,
};

export default GameInfo;
11 changes: 9 additions & 2 deletions src/components/Game/Detail/Info/GameInfos.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const GameInfos = ({game}) => {
releases_normalized: releases = [],
website,
locations,
cantons,
publishers,
sponsors,
social_networks,
Expand Down Expand Up @@ -81,12 +82,18 @@ const GameInfos = ({game}) => {
title: 'game.members',
content: members?.data.map(renderStudioPeople),
count: members?.data.length,
childrenClass: 'flex flex-col',
},
{
title: 'game.locations',
content: locations?.data.map(({name}) => name).join(', '),
count: locations?.data.length,
},
{
title: 'game.cantons',
content: cantons?.data.map(({name}) => name).join(', '),
count: cantons?.data.length,
},
{
title: 'game.releases',
content: releases.length > 0 && (
Expand Down Expand Up @@ -158,8 +165,8 @@ const GameInfos = ({game}) => {
<h2 className='section-title'>{t('game.information')}</h2>
<div className='grid grid-cols-2 mb-5 gap-x-3 gap-y-8'>
{gameInfos.filter(({count}) => count === undefined || count > 0).
map(({title, content, count}, i) => (
<GameInfo key={i} title={t(title, {count})}>
map(({title, content, count, childrenClass}, i) => (
<GameInfo key={i} title={t(title, {count})} childrenClass={childrenClass}>
{content}
</GameInfo>
))}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Games/Filters/GamesFilters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const GamesFilters = ({filters}) => {
const releases =
filters?.all_filtered_release_years_histogram?.all_nested_release_years
.releases_over_time.buckets;
const locations =
filters?.all_filtered_locations?.all_nested_locations.locations_name_keyword
const cantons =
filters?.all_filtered_cantons?.all_nested_cantons.cantons_name_keyword
.buckets || [];
const genres =
filters?.all_filtered_genres?.all_nested_genres.genres_name_keyword
Expand All @@ -29,7 +29,7 @@ const GamesFilters = ({filters}) => {
<div className="text-white flex -mr-1 flex-wrap mb-3">
<BaseFilter filterName="stores" data={stores} />
<BaseFilter filterName="platforms" data={platforms} />
<BaseFilter filterName="locations" data={locations} />
<BaseFilter filterName="cantons" data={cantons} />
{releases?.length > 0 && (
<ReleasesFilter data={releases} filterName="release_year_range" />
)}
Expand Down
Loading

0 comments on commit 7c29dc1

Please sign in to comment.