Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest main #36

Merged
merged 20 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const templateLanguages = require('./src/config/templateLanguages');
*/
const filters = require('./src/config/filters');

/**
* Import the bundler configuration from /src/config/build.js
*/
const build = require('./src/config/build');

/**
* Any additional requirements can be added here
*/
Expand Down Expand Up @@ -170,6 +175,11 @@ module.exports = function (eleventyConfig) {
console.log("\n");
console.groupEnd();

/**
* Add build configuration from /src/config/build.js
*/
build(eleventyConfig);

/**
* Minify HTML output
*/
Expand Down
Empty file removed .github/.gitkeep
Empty file.
28 changes: 28 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: '👷‍♂️ Build Site'
description: 'Build the site for deployment'

inputs:
github_token:
description: 'The GitHub token to use'
required: true

runs:
using: 'composite'
steps:

# Install dependencies
- name: 🔧 Install Dependencies
shell: bash
run: npm install

# Build the site
- name: 👷‍♂️ Build Site
shell: bash
run: npm run production

# Upload the public directory as an artifact
- name: 📦 Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
name: public
path: public
60 changes: 60 additions & 0 deletions .github/actions/new-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 'New Release'
description: 'Publish a new release to GitHub'

inputs:
environment:
description: 'The environment to deploy to'
required: true

ref:
description: 'The Git ref to deploy'
required: true

github_token:
description: 'The GitHub token to use'
required: true

runs:
using: 'composite'
steps:
# Get the current date and time in both human-readable and machine-readable formats
- name: Get the date and time
shell: bash
id: get_date
run: |
echo "human_date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "machine_date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT

# Create a Git tag with the environment name and machine-readable date
- name: 🏷️ Tag version
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ inputs.github_token }}
custom_tag: "${{ inputs.environment }}-${{ steps.get_date.outputs.machine_date }}"
tag_prefix: ''

# Get the "public" artifact from this workflow
- name: Get artifact
id: get_artifact
uses: actions/download-artifact@v4
with:
name: public
path: public.tar.gz

# If this is the main branch, create a release named after the github repo slug and the human readable date
- name: 📦 Create release
if: ${{ inputs.environment == 'production' }}
uses: ncipollo/release-action@v1
with:
tag: "${{ steps.tag_version.outputs.new_tag }}"
artifacts: "public.tar.gz"
token: ${{ inputs.github_token }}
makeLatest: true
name: "${{ github.event.repository.name }} ${{ steps.get_date.outputs.human_date }}"
body: |
# ${{ inputs.environment }}

* 📅 ${{ steps.get_date.outputs.human_date }}

${{ steps.tag_version.outputs.changelog }}
72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# .github/workflows/deploy-production.yml
##
# Deploy to GitHub Pages
##

name: 🚀 Deploy to GitHub Pages
run-name: deploy-github-pages

on:
workflow_dispatch:
push:
branches:
- 'main'

env:
environment: production

jobs:

build:
# Only run this job if the repository has a GitHub Pages site
if: ${{ github.event.repository.has_pages }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout the repo
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

# Build the site
- name: 👷‍♂️ Build the site
uses: ./.github/actions/build
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Deploy the site to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: 🚀 Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: public

release:
needs: build
runs-on: ubuntu-latest
steps:

# Checkout the repo
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

# Create a new release
- name: 📦 Create Release
uses: ./.github/actions/new-release
with:
environment: ${{ env.environment }}
ref: ${{ github.sha }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
name: Remove ZeroPoint branding when used as a template

name: 🧹 Remove ZeroPoint branding
on: [push]

jobs:
check-version:
rebrand:
runs-on: ubuntu-latest
if: github.repository != 'MWDelaney/ZeroPoint'
steps:

- name: Get current branch name
run: echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})"
run: |
echo "branch=$(echo '${{ github.ref }}' | awk -F '/' '{print $3}')" >> $GITHUB_OUTPUT
shell: bash
id: getBranch

- name: Get to the owner of this repository
run: echo "::set-output name=owner::$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')"
run: echo "owner=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_OUTPUT
shell: bash
id: getOwner

- name: Get the repository name and convert it to lowercase
run: echo "::set-output name=slug::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')"
run: echo "slug=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
shell: bash
id: getSlug

- name: Get the repository name
run: echo "::set-output name=name::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
shell: bash
id: getName

- name: Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ steps.getBranch.outputs.branch }}
Expand All @@ -41,14 +41,14 @@ jobs:
replace: ${{ steps.getOwner.outputs.owner }}
regex: false

- name: Replace repository slug
- name: Replace repository name
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "ZeroPoint"
replace: ${{ steps.getSlug.outputs.slug }}
regex: false

- name: Replace repository name
- name: Replace repository slug
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "zeropoint"
Expand All @@ -68,8 +68,8 @@ jobs:
target: "README.md"

- name: Commit changes and delete this workflow
uses: EndBug/add-and-commit@v7
uses: EndBug/add-and-commit@v9
with:
remove: '["./.github/workflows/zeropoint_template.yml", "./README.ZeroPoint.md"]'
remove: '["./.github/workflows/zeropoint-template.yml", "./README.ZeroPoint.md"]'
message: "Up to zero 🪐"
tag: 'v1.0.0 --force'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
20
Loading