Skip to content

Commit

Permalink
add cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandzors committed Jun 4, 2024
1 parent a33a9a5 commit ce5599e
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 999 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Deploy Site

on:
push:
branches:
- dev
- main

jobs:
dev:
if: github.ref =='refs/heads/dev' && !contains(github.event.head_commit.message, '!noci')
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node
with:
node-version: '20.12.1'

- name: Public IP
id: ip
uses: candidob/get-runner-ip@v1.0.0

- name: Setup Linode Cloud Firewall
uses: linode/action-linode-cli@v1
with:
token: "${{ secrets.LINODE_CLI_TOKEN }}"

- name: build dev
id: build
env:
dev-url: '${{secrets.DEVURL}}'
blog-url: '${{secrets.BLOGURL}}'
run: |
sed -i -e 's#${{env.blog-url}}#'${{ env.dev-url }}'#g' ./src/config.yml
npm run build
- name: test production site
uses: chabad360/htmlproofer@master
id: testing
with:
directory: "./dist/"
arguments: --disable-external --checks --allow-hash-href --ignore_urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"

- name: Setup SSH
id: ssh-setup
run: |
mkdir ~/.ssh
touch ~/.ssh/known_hosts
echo ${{ secrets.LINODEFINGERPRINT }} >> ~/.ssh/known_hosts
- name: Open Linode Cloud Firewall for GH
if: (steps.ssh-setup.outcome == 'success')
id: linode-fw-open
env:
PUB_IP: "${{ steps.ip.outputs.ipv4 }}/32"
HOME_IP: "${{ secrets.HOMEIP }}"
LINODE_FW_ID: "${{ secrets.LINODE_FW_ID }}"
run: |
bash ./.github/linode.sh -a --verbose
- name: deploy blog
uses: burnett01/rsync-deployments@5.2.1
id: deploy
with:
switches: -avr
path: ./dist/
remote_path: /opt/sites/astro-blog-test/
remote_host: ${{ secrets.LINODEHOST }}
remote_port: 22
remote_user: ${{ secrets.LINODEUSER }}
remote_key: ${{ secrets.LINODESSHKEY }}

- name: Close Linode Cloud Firewall for GH
if: (steps.deploy.outcome == 'success') || (steps.deploy.outcome == 'failed' || steps.deploy.outcome == 'skipped')
id: linode-fw-close
run: |
bash ./.github/linode.sh -d --verbose
14 changes: 14 additions & 0 deletions .github/workflows/linode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#/bin/bash

while getopts ":a:d" option; do
case $option in
a)
linode-cli firewalls rules-update $LINODE_FW_ID \
--inbound '[{"action":"ACCEPT", "protocol": "TCP", "ports": "22", "addresses": {"ipv4": ["'$HOME_IP'", "'$PUB_IP'"]}, "label": "accept-inbound-SSH"}, {"action":"ACCEPT", "protocol": "TCP", "ports": "80", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::/0"]}, "label": "accept-inbound-HTTP"}, {"action":"ACCEPT", "protocol": "TCP", "ports": "443", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::/0"]}, "label": "accept-inbound-HTTPS"}]'
;;
d)
linode-cli firewalls rules-update $LINODE_FW_ID \
--inbound '[{"action":"ACCEPT", "protocol": "TCP", "ports": "22", "addresses": {"ipv4": ["'$HOME_IP'"]}, "label": "accept-inbound-SSH"}, {"action":"ACCEPT", "protocol": "TCP", "ports": "80", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::/0"]}, "label": "accept-inbound-HTTP"}, {"action":"ACCEPT", "protocol": "TCP", "ports": "443", "addresses": {"ipv4": ["0.0.0.0/0"], "ipv6": ["::/0"]}, "label": "accept-inbound-HTTPS"}]'
;;
esac
done
Binary file modified src/assets/favicons/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/favicons/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions src/components/widgets/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { socialLinks = [], secondaryLinks = [], links = [], footNote = '', theme
<footer class:list={[{ dark: theme === 'dark' }, 'relative border-t border-gray-200 dark:border-slate-800 not-prose']}>
<div class="dark:bg-dark absolute inset-0 pointer-events-none" aria-hidden="true"></div>
<div class="relative max-w-7xl mx-auto px-4 sm:px-6 dark:text-slate-300">
<div class="grid grid-cols-12 gap-4 gap-y-8 sm:gap-8 py-8 md:py-12">
<!-- <div class="grid grid-cols-12 gap-4 gap-y-8 sm:gap-8 py-8 md:py-12">
<div class="col-span-12 lg:col-span-4">
<div class="mb-2">
<a class="inline-block font-bold text-xl" href={getHomePermalink()}>{SITE?.name}</a>
Expand Down Expand Up @@ -71,7 +71,7 @@ const { socialLinks = [], secondaryLinks = [], links = [], footNote = '', theme
</div>
))
}
</div>
</div> -->
<div class="md:flex md:items-center md:justify-between py-6 md:py-8">
{
socialLinks?.length ? (
Expand All @@ -96,6 +96,20 @@ const { socialLinks = [], secondaryLinks = [], links = [], footNote = '', theme

<div class="text-sm mr-4 dark:text-muted">
<Fragment set:html={footNote} />
<div class="text-sm text-muted flex gap-1">
{
secondaryLinks.map(({ text, href }, index) => (
<>
{index !== 0 ? ' · ' : ''}
<a
class="text-muted hover:text-gray-700 dark:text-gray-400 hover:underline transition duration-150 ease-in-out"
href={href}
set:html={text}
/>
</>
))
}
</div>
</div>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions src/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ site:
# Default SEO metadata
metadata:
title:
default: AstroWind
template: '%s — AstroWind'
description: "\U0001F680 Suitable for Startups, Small Business, Sass Websites, Professional Portfolios, Marketing Websites, Landing Pages & Blogs."
default: Alex's Blog
template: '%s — Alex's Blog'
description: "A blog that follows Alex's homelab adventures and random tech things."
robots:
index: true
follow: true
openGraph:
site_name: AstroWind
site_name: Alex's Blog
images:
- url: '~/assets/images/default.png'
width: 1200
height: 628
type: website
twitter:
handle: '@onwidget'
site: '@onwidget'
cardType: summary_large_image
handle:
site:
cardType:

i18n:
language: en
Expand Down
51 changes: 0 additions & 51 deletions src/content/post/get-started-website-with-astro-tailwind-css.md

This file was deleted.

Loading

0 comments on commit ce5599e

Please sign in to comment.