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

Implement Github Actions Based Deployment #134

Closed
wants to merge 10 commits into from
Closed
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
43 changes: 34 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ on:
branches: [main]
schedule:
- cron: "00 13 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
build:
Expand All @@ -24,12 +43,18 @@ jobs:
run: npm ci
- run: npm run fetchEvents
- run: npm run build
- name: Commit events-data.ts
run: |
git status
git config --global user.name 'Newwwie Bot'
git config --global user.email '[email protected]'
git add src/js/events/events-data.ts
git add dist
git commit -m "Get latest set of Meetup events"
git push
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#OS junk files
.direnv
.idea
.pre-commit-config.yaml
[Tt]humbs.db
*.DS_Store

node_modules
*.sass-cache/
*.log
*.log.*
*.sass-cache/
dist
node_modules
sftp-config.json
/uploads
uploads
yarn.lock
.idea
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

1 change: 0 additions & 1 deletion dist/css/main.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/js/main.js

This file was deleted.

10 changes: 5 additions & 5 deletions fetch-events/fetch-events.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from "lodash";
import * as _ from "lodash";
import axios from "axios";
import dayjs from "dayjs";
import path from "path";
import { DateTime } from "luxon";
import * as path from "path";
import { readFileSync, writeFileSync } from "fs";
import { renderString } from "nunjucks";

Expand All @@ -10,7 +10,7 @@ import { GroupEdge, GroupResponse, MEETUP_GQL_QUERY } from "./types";
import { Meetups } from "./meetups.json";

const MEETUP_GQL_URL = "https://www.meetup.com/gql";
const END_DATE_RANGE = dayjs().add(3, "month").toISOString(); // Retrieve up to three months from the current date
const END_DATE_RANGE = DateTime.now().plus({ months: 3 }).toISO(); // Retrieve up to three months from the current date
const EVENT_OUTPUT_FILE = path.join(__dirname, "../src/js/events/events-data.ts");
const EVENT_TEMPLATE_FILE = path.join(__dirname, "./event-data-template.njk");

Expand Down Expand Up @@ -49,7 +49,7 @@ const getGroupEvents = async (groupName: string): Promise<EventItem[]> => {
console.log("Rendering the events file");
const template = readFileSync(EVENT_TEMPLATE_FILE, "utf-8");
const rendered = renderString(template, {
generationTime: dayjs().toISOString(),
generationTime: DateTime.now().toISO(),
sortedEvents,
});

Expand Down
36 changes: 18 additions & 18 deletions fetch-events/meetups.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"Meetups": [
"NewcastleJS-JavaScript-Meetup",
"Agile-Newcastle",
"Newcastle-Coders-Group",
"Newcastle-Software-Development-Meetup",
"Blast-Furnace",
"Newcastle-IoT-Pioneers",
"The-Things-Network-Meetup-Newcastle-Lake-Macquarie",
"Newcastle-Data-Analytics-Meetup",
"Newcastle-Futurists",
"IxDA-Newcastle",
"Blockchain-Incubator-Tank",
"blockchain-newcastle",
"Core-Electronics-Workshops",
"TOOOL-au-Newcastle-Locksport-Security-Enthusiast-Meetup",
"Newcastle-Virtual-Reality-Meetup",
"Crypto-Newcastle-Intelligence-Traded",
"Diversity-in-Technology-Newcastle",
"Newcastle-SEO",
"meetup-group-xveezgem",
"Blockchain-Incubator-Tank",
"Hunter-Information-and-Analytics-Forum",
"Crypto-Newcastle-Intelligence-Traded",
"IxDA-Newcastle",
"meetup-group-xveezgem",
"Newcastle-Blockchain",
"Newcastle-Infracoders",
"Newcastle-Coders-Group",
"Newcastle-Cyber-Security-Group",
"qa-newcastle",
"newcastle-women-and-gender-diverse-people-in-tech",
"Newcastle-Data-Analytics-Meetup",
"Newcastle-Futurists",
"Newcastle-Infracoders",
"Newcastle-IoT-Pioneers",
"newcastle-salesforce-community-group",
"blockchain-newcastle"
"Newcastle-SEO",
"Newcastle-Software-Development-Meetup",
"Newcastle-Virtual-Reality-Meetup",
"newcastle-women-and-gender-diverse-people-in-tech",
"NewcastleJS-JavaScript-Meetup",
"qa-newcastle",
"The-Things-Network-Meetup-Newcastle-Lake-Macquarie",
"TOOOL-au-Newcastle-Locksport-Security-Enthusiast-Meetup"
]
}
Loading