-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,70 @@ | ||
name: Publish | ||
|
||
on: | ||
'on': | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '0 10,15,20 * * *' | ||
- cron: '0 10,15,20 * * *' | ||
workflow_dispatch: {} | ||
repository_dispatch: | ||
types: [publish] | ||
|
||
types: | ||
- publish | ||
jobs: | ||
github-pages: | ||
job: | ||
name: Github Pages | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
pages: write | ||
id-token: write | ||
contents: read | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Check out source repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download lock file | ||
run: wget https://patch.discoverygc.com/patchlist.xml | ||
|
||
- name: Cache Freelancer | ||
id: cache-freelancer | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-freelancer-discovery-${{ hashFiles('patchlist.xml') }} | ||
path: ${{ github.workspace }}/freelancer_folder | ||
- name: Check out source repository | ||
uses: actions/checkout@v3 | ||
- name: Download lock file | ||
run: wget https://patch.discoverygc.com/patchlist.xml | ||
- name: Cache Freelancer | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-freelancer-discovery-${{ hashFiles('patchlist.xml') }} | ||
path: ${{ github.workspace }}/freelancer_folder | ||
id: cache-freelancer | ||
- name: Checkout Freelancer | ||
if: ${{ steps.cache-freelancer.outputs.cache-hit != 'true' }} | ||
uses: darklab8/infra/.github/actions/checkout-freelancer@master | ||
with: | ||
freelancer-mod: discovery | ||
freelancer-folder: ${{ github.workspace }}/freelancer_folder | ||
ssh-key-base64-discovery: ${{ secrets.ID_RSA_FILES_FREELANCER_DISCOVERY }} | ||
- name: Install Go | ||
uses: darklab8/infra/.github/actions/install-go@master | ||
- name: Patch to latest | ||
run: go run autopatch.go -wd ${{ github.workspace }}/freelancer_folder | ||
- name: temporal fix to disco bugs | ||
shell: python | ||
run: | | ||
filename = "${{ github.workspace }}/freelancer_folder/DATA/initialworld.ini" | ||
with open(filename, "r") as file: | ||
data = file.read() | ||
- uses: darklab8/infra/.github/actions/checkout-freelancer@master | ||
if: ${{ steps.cache-freelancer.outputs.cache-hit != 'true' }} | ||
with: | ||
freelancer-mod: "discovery" | ||
freelancer-folder: ${{ github.workspace }}/freelancer_folder | ||
ssh-key-base64-discovery: ${{ secrets.ID_RSA_FILES_FREELANCER_DISCOVERY }} | ||
replaced = data.replace("rep = 0.-55, gd_im_grp", "rep = -0.55, gd_im_grp") | ||
- name: Set up Go | ||
uses: darklab8/infra/.github/actions/install-go@master | ||
|
||
- name: Patch to latest | ||
run: go run ${{ github.workspace }}/autopatch.go -wd ${{ github.workspace }}/freelancer_folder | ||
|
||
- name: temporal fix to disco bugs | ||
shell: python | ||
run: | | ||
filename = "${{ github.workspace }}/freelancer_folder/DATA/initialworld.ini" | ||
with open(filename, "r") as file: | ||
data = file.read() | ||
replaced = data.replace("rep = 0.-55, gd_im_grp", "rep = -0.55, gd_im_grp") | ||
with open(filename, "w") as file: | ||
file.write(replaced) | ||
- uses: darklab8/fl-darkstat/.github/actions/build@master | ||
with: | ||
site-root: "/fl-data-discovery/" | ||
freelancer-folder: ${{ github.workspace }}/freelancer_folder | ||
heading: <a href="https://github.com/darklab8/fl-darkstat">Darkstat</a> from <a href="https://darklab8.github.io/blog/pet_projects.html#Freelancercommunity">DarkTools</a> for <a href="https://github.com/darklab8/fl-data-discovery">Freelancer Discovery</a> | ||
relay-host: "https://darkrelay.dd84ai.com" | ||
|
||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
name: github-pages | ||
path: ./build | ||
|
||
# Turn on ability to deploy to pages in repository settings, Pages tab | ||
# choose "Github Actions" deployment method to Pages | ||
- name: Deploy to pages | ||
uses: actions/deploy-pages@v1 | ||
id: deployment | ||
with open(filename, "w") as file: | ||
file.write(replaced) | ||
- name: Darkstat Build | ||
uses: darklab8/fl-darkstat/.github/actions/build@master | ||
with: | ||
site-root: /fl-data-discovery/ | ||
freelancer-folder: ${{ github.workspace }}/freelancer_folder | ||
heading: <a href="https://github.com/darklab8/fl-darkstat">Darkstat</a> from <a href="https://darklab8.github.io/blog/pet_projects.html#Freelancercommunity">DarkTools</a> for <a href="https://github.com/darklab8/fl-data-discovery">Freelancer Discovery</a> | ||
relay-host: https://darkrelay.dd84ai.com | ||
- name: Upload artifacts for deployment to Github Pages | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
name: github-pages | ||
path: './build' | ||
- name: Deploy to pages | ||
uses: actions/deploy-pages@v1 | ||
id: deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import .wf_publish | ||
import infra.kcls.common.workflow | ||
|
||
import yaml | ||
|
||
_workflows = [ | ||
wf_publish._workflow | ||
] | ||
|
||
_run = [yaml.dump_to_file(a, ".github/workflows/${a._filename}", ignore_private=True, ignore_none=True) for a in _workflows] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "kcls" | ||
edition = "v0.11.0" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
infra = { path = "../../infra", version = "0.0.1" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[dependencies] | ||
[dependencies.infra] | ||
name = "infra" | ||
full_name = "infra_0.0.1" | ||
version = "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import infra.kcls.models.github_action as ga | ||
import infra.kcls.models.github_workflow as gw | ||
import infra.kcls.common.github as ghc | ||
import infra.kcls.actions.checkout_freelancer as cf | ||
import infra.kcls.actions.install_go | ||
import infra.kcls.actions.darkstat | ||
|
||
_freelancer_folder = r"${{ github.workspace }}/freelancer_folder" | ||
|
||
_workflow = gw.Workflow { | ||
_filename = "publish.yaml" | ||
name = "Publish" | ||
on = { | ||
workflow_dispatch: {} | ||
push.branches = ["master"] | ||
schedule:[{cron="0 10,15,20 * * *"}] | ||
repository_dispatch: {types: ["publish"]} | ||
} | ||
jobs = { | ||
job = _publish_job | ||
} | ||
} | ||
_publish_job: gw.Job = { | ||
name = "Github Pages" | ||
permissions: ghc.PagesPermissions {} | ||
environment: dict(ghc.PagesEnvironment {}) | ||
steps = [ | ||
ghc.CheckoutRepo | ||
ga.Step{ | ||
name = "Download lock file" | ||
run = "wget https://patch.discoverygc.com/patchlist.xml" | ||
} | ||
ga.Step { | ||
name = "Cache Freelancer" | ||
id = "cache-freelancer" | ||
uses = "actions/cache@v3" | ||
with= { | ||
key = r"${{ runner.os }}-freelancer-discovery-${{ hashFiles('patchlist.xml') }}" | ||
path = _freelancer_folder | ||
} | ||
} | ||
cf.NewCheckoutFreelancer(cf.CheckoutArgs { | ||
freelancer_mod = cf._mod_discovery | ||
freelancer_folder = _freelancer_folder | ||
$if = r"${{ steps.cache-freelancer.outputs.cache-hit != 'true' }}" | ||
}) | ||
install_go.InstallGo{} | ||
ga.Step{ | ||
name = "Patch to latest" | ||
run = "go run autopatch.go -wd ${_freelancer_folder}" | ||
} | ||
ga.Step{ | ||
name = "temporal fix to disco bugs" | ||
shell = "python" | ||
run = """filename = "${_freelancer_folder}/DATA/initialworld.ini" | ||
with open(filename, "r") as file: | ||
data = file.read() | ||
|
||
replaced = data.replace("rep = 0.-55, gd_im_grp", "rep = -0.55, gd_im_grp") | ||
|
||
with open(filename, "w") as file: | ||
file.write(replaced) | ||
""" | ||
} | ||
darkstat.Build(darkstat.BuildArgs{ | ||
site_root = "/fl-data-discovery/" | ||
freelancer_folder = _freelancer_folder | ||
heading = '<a href="https://github.com/darklab8/fl-darkstat">Darkstat</a> from <a href="https://darklab8.github.io/blog/pet_projects.html#Freelancercommunity">DarkTools</a> for <a href="https://github.com/darklab8/fl-data-discovery">Freelancer Discovery</a>' | ||
relay_host = "https://darkrelay.dd84ai.com" | ||
}) | ||
] + ghc.PagesToDeploySteps(ghc.PagesDeployOpts {}) | ||
} |