-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Development daschi
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ORIGIN=$ORIGIN |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ORIGIN=https://green-hell-maps.daschi.dev |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Build and Publish Docker Image | ||
|
||
# This workflow triggers on a push to the main branch or pull requests targeting the main branch. | ||
on: | ||
push: | ||
branches: [ "main" ] # Trigger on push to the main branch | ||
pull_request: | ||
branches: [ "main" ] # Trigger on pull requests to the main branch | ||
|
||
env: | ||
# Docker registry configuration | ||
REGISTRY: ghcr.io # Use GitHub Container Registry by default | ||
IMAGE_NAME: ${{ github.repository }} # Docker image name is the GitHub repository name | ||
|
||
jobs: | ||
build-and-publish: | ||
|
||
runs-on: ubuntu-latest # Use the latest Ubuntu runner for this job | ||
permissions: | ||
contents: read # Allows the workflow to read repository contents | ||
packages: write # Allows the workflow to write to GitHub Packages (e.g., Docker images) | ||
id-token: write # Required for signing Docker images with cosign outside of PRs | ||
|
||
steps: | ||
# Step 1: Check out the repository code | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# This step checks out the repository code so the workflow can access it | ||
|
||
# Step 2: Extract version information from package.json | ||
- name: Extract version from package.json | ||
id: version | ||
run: | | ||
# Extract the full version (e.g., 1.2.3) from package.json | ||
MAJOR_MINOR_PATCH=$(grep '"version":' package.json | cut -d '"' -f 4) | ||
# Extract the major.minor version (e.g., 1.2) | ||
MAJOR_MINOR=$(echo $MAJOR_MINOR_PATCH | cut -d '.' -f1-2) | ||
# Extract the major version (e.g., 1) | ||
MAJOR=$(echo $MAJOR_MINOR_PATCH | cut -d '.' -f1) | ||
# Store the extracted values as environment variables for use in later steps | ||
echo "MAJOR_MINOR_PATCH=$MAJOR_MINOR_PATCH" >> $GITHUB_ENV | ||
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV | ||
echo "MAJOR=$MAJOR" >> $GITHUB_ENV | ||
# Step 3: Install the cosign tool for signing Docker images | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' # Only install cosign if not a PR | ||
uses: sigstore/cosign-installer@v3 | ||
# This installs the cosign tool for use in the signing step later | ||
|
||
# Step 4: Set up Docker Buildx for building multi-platform Docker images | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
# Docker Buildx enables advanced features like multi-platform builds and cache exporting | ||
|
||
# Step 5: Log in to the Docker registry | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} # The Docker registry to log into | ||
username: ${{ github.actor }} # Use the GitHub actor (user) as the username | ||
password: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub token as the password | ||
# This step logs in to the Docker registry so that images can be pushed | ||
|
||
# Step 6: Extract Docker image metadata (tags, labels) | ||
- name: Extract Docker metadata | ||
id: meta # Assigns an ID to this step for referencing its outputs later | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
# Define tags for the Docker image using version information | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.MAJOR_MINOR_PATCH }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.MAJOR_MINOR }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.MAJOR }} | ||
# Step 7: Build and push Docker image using Docker Buildx | ||
- name: Build and push Docker image | ||
id: build-and-push # Assigns an ID to this step for referencing its outputs later | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . # The context is the root of the repository | ||
push: ${{ github.event_name != 'pull_request' }} # Only push if not a PR | ||
tags: ${{ steps.meta.outputs.tags }} # Use the tags generated in the previous step | ||
labels: ${{ steps.meta.outputs.labels }} # Use the labels generated in the previous step | ||
cache-from: type=gha # Use GitHub Actions cache to speed up builds | ||
cache-to: type=gha,mode=max # Store the cache in GitHub Actions for reuse | ||
# This step builds the Docker image and pushes it to the registry (if not a PR) | ||
|
||
# Step 8: Sign the resulting Docker image digest (only if not a PR) | ||
- name: Sign the published Docker image | ||
if: ${{ github.event_name != 'pull_request' }} # Only sign if not a PR | ||
env: | ||
TAGS: ${{ steps.meta.outputs.tags }} # Use the tags generated earlier | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} # Use the digest of the built image | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | ||
# This step signs the Docker image using cosign to ensure its integrity and authenticity |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Start with a base image with Node.js | ||
FROM node:20-alpine | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy only package.json initially to avoid cache busting | ||
COPY package.json ./ | ||
|
||
# Install pnpm using the version specified in the packageManager field of package.json and log the version | ||
RUN set -ex; \ | ||
PNPM_VERSION=$(grep '"packageManager":' package.json | cut -d '"' -f 4 | cut -d '@' -f 2); \ | ||
npm install -g pnpm@$PNPM_VERSION; | ||
|
||
# Copy other files as needed | ||
COPY . . | ||
|
||
# Install app dependencies using pnpm | ||
RUN pnpm install --frozen-lockfile | ||
|
||
# Build the app | ||
RUN pnpm run build | ||
|
||
# Expose port 3000 | ||
EXPOSE 3000 | ||
|
||
# Set entrypoint | ||
CMD [ "node", "-r", "dotenv/config", "build" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
# create-svelte | ||
# green-hell-maps | ||
|
||
Everything you need to build a Svelte project, powered | ||
by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). | ||
### [Green Hell Maps](https://green-hell-maps.daschi.dev/) | ||
|
||
## Creating a project | ||
Available for [Story Mode](https://green-hell-maps.daschi.dev/story-mode) | ||
and [Spirits of Amazonia](https://green-hell-maps.daschi.dev/spirits-of-amazonia). | ||
|
||
If you're seeing this, you've probably already done this step. Congrats! | ||
### Credits | ||
|
||
```bash | ||
# create a new project in the current directory | ||
npm create svelte@latest | ||
Map design by [u/alex3omg](https://www.reddit.com/user/alex3omg/), originally | ||
posted [here](https://www.reddit.com/r/GreenHell/comments/11miatv/green_hell_full_map_with_icons_spoilers_story_and/) | ||
on [r/GreenHell](https://www.reddit.com/r/GreenHell/). | ||
Slightly modified to include coordinates on both sides of the maps. | ||
|
||
# create a new project in my-app | ||
npm create svelte@latest my-app | ||
``` | ||
[Green Hell](https://greenhell-game.com/) is a game developed | ||
by [Creepy Jar](https://creepyjar.com/en/). | ||
|
||
## Developing | ||
Created by [Daschi](https://github.com/Daschi1) with ♥ and | ||
many [open-source projects](https://green-hell-maps.daschi.dev/licenses)! | ||
Source code available on [GitHub](https://github.com/Daschi1/green-hell-maps). | ||
|
||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` | ||
or `yarn`), start a development server: | ||
### Generate `licenses.json` | ||
|
||
```bash | ||
npm run dev | ||
The command uses [license-checker](https://github.com/davglass/license-checker) to | ||
generate `licenses.json`. | ||
|
||
# or start the server and open the app in a new browser tab | ||
npm run dev -- --open | ||
```shell | ||
license-checker --customPath lc-checker-format.json --json --out static/licenses.json | ||
``` | ||
|
||
## Building | ||
|
||
To create a production version of your app: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
You can preview the production build with `npm run preview`. | ||
|
||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for | ||
> your target environment. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "", | ||
"version": "", | ||
"description": "", | ||
"licenseFile": false, | ||
"licenseText": false, | ||
"path": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{ | ||
"name": "soa-map", | ||
"version": "0.0.1", | ||
"private": true, | ||
"name": "green-hell-maps", | ||
"version": "1.0.0", | ||
"description": "Green Hell interactive maps", | ||
"repository": "https://github.com/Daschi1/green-hell-maps", | ||
"author": "Daschi", | ||
"private": false, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
|
@@ -12,25 +16,31 @@ | |
"format": "prettier --write ." | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^3.2.2", | ||
"@sveltejs/kit": "^2.5.18", | ||
"@sveltejs/adapter-node": "^5.2.1", | ||
"@sveltejs/kit": "^2.5.21", | ||
"@sveltejs/vite-plugin-svelte": "^3.1.1", | ||
"@types/eslint": "^9.6.0", | ||
"autoprefixer": "^10.4.19", | ||
"eslint": "^9.8.0", | ||
"autoprefixer": "^10.4.20", | ||
"eslint": "^9.9.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-svelte": "^2.43.0", | ||
"globals": "^15.8.0", | ||
"postcss": "^8.4.40", | ||
"flowbite": "^2.5.1", | ||
"flowbite-svelte": "^0.46.15", | ||
"flowbite-svelte-icons": "2.0.0-next.15", | ||
"globals": "^15.9.0", | ||
"license-checker": "^25.0.1", | ||
"npm-check-updates": "^17.0.6", | ||
"postcss": "^8.4.41", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-svelte": "^3.2.6", | ||
"prettier-plugin-tailwindcss": "^0.6.5", | ||
"svelte": "^5.0.0-next.202", | ||
"prettier-plugin-tailwindcss": "^0.6.6", | ||
"svelte": "^5.0.0-next.216", | ||
"svelte-check": "^3.8.5", | ||
"tailwindcss": "^3.4.7", | ||
"sveltekit-search-params": "^3.0.0", | ||
"tailwindcss": "^3.4.9", | ||
"typescript": "^5.5.4", | ||
"typescript-eslint": "^8.0.0-alpha.60", | ||
"vite": "^5.3.5" | ||
"typescript-eslint": "^8.0.1", | ||
"vite": "^5.4.0" | ||
}, | ||
"type": "module" | ||
} |