diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c2755a9..aa6af52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/README.md b/README.md index 75586b1..f6fcfc0 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/docker-compose.yml b/docker-compose.yml index 0cc76c7..fcda9f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: - rack-planner: - build: . - ports: - - "1019:80" - restart: always + rack-planner: + build: . + ports: + - '1019:80' + restart: always diff --git a/index.html b/index.html index 039d76a..108b407 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,14 @@ +
+ + + +