Skip to content

Commit ccce402

Browse files
committed
Initial files
1 parent 84ee0a9 commit ccce402

File tree

123 files changed

+5405
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+5405
-0
lines changed

.github/workflows/deploy-site.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
paths:
6+
- .github/workflows/*
7+
- _config.yml
8+
- assets/**
9+
- content/**
10+
- data/**
11+
- i18n/**
12+
- layouts/**
13+
- static/**
14+
15+
name: Site Deployment
16+
17+
jobs:
18+
deploy:
19+
name: Deployment
20+
runs-on: ubuntu-18.04
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Setup Hugo
26+
uses: peaceiris/actions-hugo@v2
27+
with:
28+
hugo-version: latest
29+
extended: true
30+
31+
- name: Build site
32+
run: hugo -gcc
33+
34+
- name: Deploy site
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./public
39+
force_orphan: true
40+
cname: scratchaddons.com

.github/workflows/test-site-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
paths:
6+
- .github/workflows/*
7+
- _config.yml
8+
- assets/**
9+
- content/**
10+
- data/**
11+
- i18n/**
12+
- layouts/**
13+
- static/**
14+
15+
name: Site Build Testing
16+
17+
jobs:
18+
test:
19+
name: Testing
20+
runs-on: ubuntu-18.04
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Setup Hugo
26+
uses: peaceiris/actions-hugo@v2
27+
with:
28+
hugo-version: latest
29+
extended: true
30+
31+
- name: Build site
32+
run: hugo -gcc
33+
34+
- name: Deploy site
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./public
39+
force_orphan: true
40+
cname: scratchaddons.com
41+
42+
- name: Upload build
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: public
46+
path: ./public
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
ref:
5+
description: Reference on ScratchAddons/ScratchAddons
6+
required: false
7+
default: master
8+
9+
name: Addons Data Update
10+
11+
jobs:
12+
update:
13+
name: Update
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout ScratchAddons/Website
17+
uses: actions/checkout@v2
18+
- name: Checkout ScratchAddons/addons-data-updater
19+
uses: actions/checkout@v2
20+
with:
21+
repository: ScratchAddons/addons-data-updater
22+
path: ../script
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: 14.x
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v2
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: ${{ runner.os }}-node-
35+
36+
- name: Install dependencies
37+
run: npm install --prefix ../script
38+
39+
- name: Update addons data
40+
run: node ../script/index.js ${{ github.event.inputs.ref }}
41+
42+
- name: Generate token
43+
uses: tibdex/github-app-token@v1
44+
id: generate-token
45+
with:
46+
app_id: ${{ secrets.BOT_APP_ID }}
47+
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
48+
49+
- name: Create pull request
50+
uses: peter-evans/create-pull-request@v3
51+
with:
52+
token: ${{ steps.generate-token.outputs.token }}
53+
commit-message: Update addons data
54+
branch: create-pull-request/addon-data
55+
committer: scratchaddons-bot[bot] <73682299+scratchaddons-bot[bot]@users.noreply.github.com>
56+
delete-branch: true
57+
title: Update addons data
58+
body: |
59+
This updates the addons data based on the main repo.
60+
61+
It is recommended to do a rebase merge than other methods. Also, make sure to not merge something that isn't released yet!
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- .github/workflows/update-changelog.yml
8+
9+
name: Changelog Update
10+
11+
jobs:
12+
update:
13+
name: Update
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Update changelog
20+
run: |
21+
SAVEIFS=$IFS
22+
IFS=$'\n'
23+
24+
DO_PRINT_1=true
25+
DESTINATION_FILE="content/changelog.md"
26+
27+
print_line() {
28+
echo $1 >> "$DESTINATION_FILE.tmp"
29+
}
30+
31+
while read -r line1; do
32+
if [[ $line1 == "<!-- sa-changelog-end -->" ]]; then
33+
DO_PRINT_1=true
34+
fi
35+
if [[ $DO_PRINT_1 = true ]]; then
36+
print_line "$line1"
37+
fi
38+
if [[ $line1 == "<!-- sa-changelog-start -->" ]]; then
39+
DO_PRINT_1=false
40+
DO_PRINT_2=false
41+
while read -r line2; do
42+
if [[ $line2 == "<!-- sa-changelog-end -->" ]]; then
43+
DO_PRINT_2=false
44+
fi
45+
if [[ $DO_PRINT_2 = true ]]; then
46+
print_line "$line2"
47+
fi
48+
if [[ $line2 == "<!-- sa-changelog-start -->" ]]; then
49+
DO_PRINT_2=true
50+
fi
51+
done <<< "$(curl https://raw.githubusercontent.com/ScratchAddons/ScratchAddons/changelog/CHANGELOG.md)"
52+
fi
53+
54+
done <<< "$(tr -d '\r' < $DESTINATION_FILE)"
55+
56+
IFS=$SAVEIFS
57+
58+
perl -pi -e 's/\n/\r\n/g' "$DESTINATION_FILE.tmp"
59+
rm -rf "$DESTINATION_FILE"
60+
mv "$DESTINATION_FILE.tmp" "$DESTINATION_FILE"
61+
62+
- name: Generate token
63+
uses: tibdex/github-app-token@v1
64+
id: generate-token
65+
with:
66+
app_id: ${{ secrets.BOT_APP_ID }}
67+
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
68+
69+
- name: Create pull request
70+
uses: peter-evans/create-pull-request@v3
71+
with:
72+
token: ${{ steps.generate-token.outputs.token }}
73+
commit-message: Update changelog
74+
branch: create-pull-request/changelog
75+
committer: scratchaddons-bot[bot] <73682299+scratchaddons-bot[bot]@users.noreply.github.com>
76+
delete-branch: true
77+
title: Update changelog
78+
body: |
79+
This updates the changelog with the main repository's version.
80+
81+
It is recommended to do a rebase merge than other methods.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public/
2+
resources/_gen/
3+
hugo_stats.json

0 commit comments

Comments
 (0)