Skip to content
Open
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
160 changes: 80 additions & 80 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
name: Publish Docker Image

on:
workflow_dispatch:
inputs:
force_republish:
description: 'Force republish existing version (overwrite Docker tag)'
required: false
type: boolean
default: false
workflow_dispatch:
inputs:
force_republish:
description: 'Force republish existing version (overwrite Docker tag)'
required: false
type: boolean
default: false

permissions:
contents: write
actions: write
contents: write
actions: write

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"

- name: Determine Version
id: determine_version
run: |
FORCE="${{ inputs.force_republish }}"
CURRENT_VERSION=$(node -p "require('./package.json').version")

if [ "$FORCE" = "true" ]; then
echo "Force republish request. Using current version v$CURRENT_VERSION without bumping."
echo "VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
elif git rev-parse "v$CURRENT_VERSION" >/dev/null 2>&1; then
echo "Tag v$CURRENT_VERSION already exists. Bumping patch version..."

# Bump version and push
npm version patch -m "chore: bump version to %s"
git push --follow-tags

# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version is $NEW_VERSION"
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
else
echo "Tag v$CURRENT_VERSION does not exist. Using current version..."
echo "VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
fi
- name: Determine Version
id: determine_version
run: |
FORCE="${{ inputs.force_republish }}"
CURRENT_VERSION=$(node -p "require('./package.json').version")

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if [ "$FORCE" = "true" ]; then
echo "Force republish request. Using current version v$CURRENT_VERSION without bumping."
echo "VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
elif git rev-parse "v$CURRENT_VERSION" >/dev/null 2>&1; then
echo "Tag v$CURRENT_VERSION already exists. Bumping patch version..."

# Bump version and push
npm version patch -m "chore: bump version to %s"
git push --follow-tags

# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version is $NEW_VERSION"
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
else
echo "Tag v$CURRENT_VERSION does not exist. Using current version..."
echo "VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
fi

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKER_USERNAME }}/rack-planner:${{ env.VERSION }}
${{ secrets.DOCKER_USERNAME }}/rack-planner:latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body: "Release for version ${{ env.VERSION }}"
draft: false
prerelease: false
allowUpdates: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKER_USERNAME }}/rack-planner:${{ env.VERSION }}
${{ secrets.DOCKER_USERNAME }}/rack-planner:latest

- name: Trigger Deployment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting for git propagation..."
sleep 5
gh workflow run deploy.yml --ref main
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body: 'Release for version ${{ env.VERSION }}'
draft: false
prerelease: false
allowUpdates: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger Deployment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting for git propagation..."
sleep 5
gh workflow run deploy.yml --ref main
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ If you just want to run the application without downloading the source code, you
```bash
docker run -d -p 1019:80 brankko/rack-planner:latest
```
*(You can change `1019` to any port you prefer, e.g., `-p 8080:80`)*

_(You can change `1019` to any port you prefer, e.g., `-p 8080:80`)_

3. Access the application at [http://localhost:1019](http://localhost:1019).

Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
rack-planner:
build: .
ports:
- "1019:80"
restart: always
rack-planner:
build: .
ports:
- '1019:80'
restart: always
24 changes: 11 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rack Planner</title>
</head>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rack Planner</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading