Skip to content

Commit

Permalink
update: contribution details, prod workflow uses prepyrus, updated PR…
Browse files Browse the repository at this point in the history
… template
  • Loading branch information
Firgrep committed Aug 3, 2024
1 parent c78f657 commit ca1196a
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 174 deletions.
63 changes: 28 additions & 35 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,55 @@

## Checklist

- [ ] Docs contribution (philosophy, literature, content). Leave **unchecked** for <code>code</code> contribution.
- [ ] Philosophical or literary contribution (docs). Leave **unchecked** for <code>code</code> contribution.

- [ ] **REQUIRED** I accept that my writing is submitted under the [ATTRIBUTION-NONCOMMERCIAL-SHAREALIKE 4.0 INTERNATIONAL](https://creativecommons.org/licenses/by-nc-sa/4.0/), which, briefly put, prohibits commercial re-use of the content, but allows sharing, remixing and building upon the material insofar as attribution is given (see [legal code](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.en)), and in this regard I understand that my writing is open to be modified, remixed and build upon by others in the sPhil community within the `systemphil/sphil` project in future perpetuity.
- [ ] **REQUIRED** I have followed the [formatting guidelines](https://github.com/systemphil/sphil/blob/dev/src/pages/contributing/formatting/basic-markdown.md) and verified there are no formatting bugs. [Try markdown preview here](https://markdownlivepreview.com/).
- [ ] **REQUIRED** I have followed the [MLA citation style](https://owl.purdue.edu/owl/research_and_citation/mla_style/mla_formatting_and_style_guide/mla_formatting_and_style_guide.html).
- [ ] **REQUIRED** I have added or verified title and description metadata at the very top of the file. Example:
- **IMPLIED CONSENT** By opening this pull request and contributing philosophical or literary content, I accept that my writing is submitted under the [ATTRIBUTION-NONCOMMERCIAL-SHAREALIKE 4.0 INTERNATIONAL](https://creativecommons.org/licenses/by-nc-sa/4.0/), which:

- Prohibits commercial reuse of the content.
- Allows sharing, remixing, and building upon the material as long as attribution is given.

I understand that my writing may be modified, remixed, and built upon by others within the `systemphil/sphil` or sPhil project, in accordance with the license terms, indefinitely. See [legal code](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.en).

- **REQUIRED** I have followed the [formatting guidelines](https://github.com/systemphil/sphil/blob/dev/src/pages/contributing/formatting/basic-markdown.md) and verified there are no formatting bugs. [Try markdown preview here](https://markdownlivepreview.com/).
- **REQUIRED** I have followed the [Chicago author-date style](https://www.chicagomanualofstyle.org/tools_citationguide/citation-guide-2.html).
- **REQUIRED** I have added or verified metadata title, description, and contributors at the _very top_ of the file followed by a `##` title heading. Additionally, I have ensured `isArticle` is set to `true`. Example:

```md
---
title: Hegel Guides
description: Learn about the philosophy of G. W. F. Hegel
title: The Immediate Difference Between Pure Being and Pure Nothing
description: Learn about the difference between being and nothing in Hegel's Science of Logic.
isArticle: true
authors: Jerry Maguire (2024)
editors: Steve Stevenson (2023), Karen Hansen (2022)
contributors:
---
```

- [ ] My article is a stub or I want to actively encourage contribution, I've added the Stub component to the bottom of my content but _before_ the bibliography:

```ts
import Stub from "@/components/Stub";

<Stub />;
## My Article Title
```

- [ ] **REQUIRED** I have added, verified or extended a bibliography. This is added before the authors section and follows MLA guidelines. Example:
<details>

```mdx
## Works Cited
<summary>Further information</summary>

<div className="text-sm">
- Hegel, Friedrich Georg Wilhelm. _The Science of Logic_. Translated
by George di Giovanni, Cambridge University Press, 2010. - Kant,
Immanuel. _The Critique of Pure Reason_. Edited by Paul Guyer and
Allen W. Wood, Cambridge University Press, 1998.
</div>
```

- [ ] I have signed the document with my name/username under either as `Authors`, `Editors` or `Contributors`.
I have signed the document with my name/username under either as `Authors`, `Editors` or `Contributors`.

> Use **Authors** if you have created and substantially added content.
> Use **Editor** if you have made substantial edits or review.
> Use **Contributor** if you have made minor edits, reviews or contributions.
> If you've done multiple, pick the most weighted: Author > Editor > Contributor.
> If you prefer to remain anonymous, that's fine too, but note that a record of your contributions based on your GitHub username will exist here in the codebase.

```md
// Bibliography goes here
</details>

---
- **REQUIRED** I have ensured that the [project's central bibliography](https://github.com/systemphil/sphil/blob/main/README_BIBLIOGRAPHY.md) contains the necessary bibliographical details for the citations I have used.

**Authors**
Ahilleas Rokni (2024), Tom Bombadil (2025)
- _Optional_ My article is a stub or I want to actively encourage contribution, I've added the Stub component to the bottom of my content or where relevant:

**Contributors**
Filip Niklas (2024), Boromir (2025)
```
```ts
import Stub from "@/components/Stub";

- [ ] If the article makes use of footnotes, I have checked that `**Notes**` is exactly the very last item in the file.
<Stub />;
```

- **If Docs contribution is unchecked:** Code contribution ([Apache version 2 license](https://www.apache.org/licenses/LICENSE-2.0.txt))
<details>
Expand Down
163 changes: 106 additions & 57 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,111 @@
name: Deploy to Production

on:
workflow_dispatch:
release:
types: [created]
workflow_dispatch:
release:
types: [created]

jobs:
build_and_deploy:
if: github.repository_owner == 'systemphil'
environment: prod
runs-on: ubuntu-latest
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
SERVICE: ${{ secrets.SERVICE }}
REGION: ${{ secrets.REGION }}
TAG: latest

steps:
- name: Check if running in the parent repository
run: |
if [ "${GITHUB_REPOSITORY}" != "systemphil/sphil" ]; then
echo "This workflow is only intended for the parent repository. Skipping deployment."
exit 1
fi
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Auth
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"

- name: Docker Auth
id: docker-auth
uses: "docker/login-action@v1"
with:
username: _json_key
password: "${{ secrets.GOOGLE_CREDENTIALS }}"
registry: "${{ env.REGION }}-docker.pkg.dev"

- name: Build and Push Container
# NEXT_PUBLIC_ env variables have to be set during the build phase.
run: |-
docker build \
--build-arg NEXT_PUBLIC_SITE_ROOT=${{secrets.NEXT_PUBLIC_SITE_ROOT}} \
--build-arg NEXT_PUBLIC_GA_ID=${{secrets.NEXT_PUBLIC_GA_ID}} \
-f Dockerfile \
-t "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}" ./
docker push "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}"
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{env.SERVICE}} \
--platform=managed \
--region=${{ env.REGION }} \
--max-instances=4 \
--min-instances=default \
--image="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}"
prepyrus_verify:
if: github.repository_owner == 'systemphil'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v4
id: prepyrus-cache-restore
with:
path: target/release/prepyrus
key: ${{ runner.os }}-cargo-${{ hashFiles('scripts/prepyrus/Cargo.lock') }}-${{ hashFiles('scripts/prepyrus/src/**') }}

- name: Install Rust
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install dependencies
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
run: cargo build --release --package prepyrus

- name: Run prepyrus script in VERIFY mode
run: target/release/prepyrus absolute_bibliography.bib src/pages verify

- name: Upload prepyrus for next job
uses: actions/upload-artifact@v4
with:
name: prepyrus_artifact
path: target/release/prepyrus

- name: Save Prepyrus to cache
id: prepyrus-cache-save
if: steps.prepyrus-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: target/release/prepyrus
key: ${{ runner.os }}-cargo-${{ hashFiles('scripts/prepyrus/Cargo.lock') }}-${{ hashFiles('scripts/prepyrus/src/**') }}

build_and_deploy:
needs: prepyrus_verify
if: github.repository_owner == 'systemphil'
environment: prod
runs-on: ubuntu-latest
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
SERVICE: ${{ secrets.SERVICE }}
REGION: ${{ secrets.REGION }}
TAG: latest

steps:
- name: Check if running in the parent repository
run: |
if [ "${GITHUB_REPOSITORY}" != "systemphil/sphil" ]; then
echo "This workflow is only intended for the parent repository. Skipping deployment."
exit 1
fi
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download prepyrus artifact
uses: actions/download-artifact@v4
with:
name: prepyrus_artifact
path: target/release/prepyrus

- name: Give execution permissions to prepyrus
run: chmod +x target/release/prepyrus/prepyrus

- name: Run prepyrus in PROCESS mode
run: target/release/prepyrus/prepyrus absolute_bibliography.bib src/pages process

- name: Auth
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"

- name: Docker Auth
id: docker-auth
uses: "docker/login-action@v1"
with:
username: _json_key
password: "${{ secrets.GOOGLE_CREDENTIALS }}"
registry: "${{ env.REGION }}-docker.pkg.dev"

- name: Build and Push Container
# NEXT_PUBLIC_ env variables have to be set during the build phase.
run: |-
docker build \
--build-arg NEXT_PUBLIC_SITE_ROOT=${{secrets.NEXT_PUBLIC_SITE_ROOT}} \
--build-arg NEXT_PUBLIC_GA_ID=${{secrets.NEXT_PUBLIC_GA_ID}} \
-f Dockerfile \
-t "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}" ./
docker push "${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}"
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{env.SERVICE}} \
--platform=managed \
--region=${{ env.REGION }} \
--max-instances=4 \
--min-instances=default \
--image="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ env.TAG }}"
3 changes: 3 additions & 0 deletions README_BIBLIOGRAPHY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# sPhil's Bibliography

_work in progress_
4 changes: 2 additions & 2 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const navigation = {
{ name: "Terms of Use", href: "/terms" },
],
support: [
{ name: "GitHub", href: "https://github.com/systemphil/" },
{ name: "YouTube", href: "https://www.youtube.com/@systemphil" },
{ name: "GitHub", href: "https://github.com/systemphil/" },
{ name: "YouTube", href: "https://www.youtube.com/@systemphil" },
],
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"title": "Contributing"
},
"contact": {
"title": "Symposia ",
"title": "Symposia 🏺",
"type": "page",
"href": "https://symposia.systemphil.com",
"newWindow": true
Expand Down
Loading

0 comments on commit ca1196a

Please sign in to comment.