Skip to content

Update Makefile to use tabs instead of spaces for commands #3

Update Makefile to use tabs instead of spaces for commands

Update Makefile to use tabs instead of spaces for commands #3

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 199, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.GITLAB_TOKEN != ''
on:
push:
tags:
- 'v*'
env:
DOCKER_IMAGE: manfredsteger/polly
NODE_VERSION: '22'
permissions:
contents: write
packages: write
jobs:
validate:
name: Validate & Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: polly_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Type Check
run: npx tsc --noEmit
- name: Validate Translations
run: node scripts/validate-translations.cjs
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U test; do
echo "Waiting for PostgreSQL..."
sleep 2
done
- name: Setup test database
env:
DATABASE_URL: postgresql://test:test@localhost:5432/polly_test
run: npm run db:push
- name: Run tests
env:
DATABASE_URL: postgresql://test:test@localhost:5432/polly_test
NODE_ENV: test
run: npx vitest run --pool=forks --poolOptions.forks.singleFork
- name: Build
run: npm run build
docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Version: $TAG"
# Determine additional tags
if [[ "$TAG" == *"beta"* ]]; then
echo "channel=beta" >> $GITHUB_OUTPUT
elif [[ "$TAG" == *"rc"* ]]; then
echo "channel=rc" >> $GITHUB_OUTPUT
else
echo "channel=latest" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.version }}
${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.channel }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- name: Verify image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.version }}
echo "Image size:"
docker images ${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.version }} --format "{{.Size}}"
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: docker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: version
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
if [[ "$TAG" == *"beta"* ]] || [[ "$TAG" == *"rc"* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Generate changelog
id: changelog
run: |
# Get previous tag
PREV_TAG=$(git tag --sort=-v:refname | grep -v "^${GITHUB_REF#refs/tags/}" | head -1)
if [ -z "$PREV_TAG" ]; then
# First release - show all commits
CHANGES=$(git log --pretty=format:"- %s (%h)" --no-merges HEAD | head -50)
else
CHANGES=$(git log --pretty=format:"- %s (%h)" --no-merges ${PREV_TAG}..HEAD | head -50)
fi
# Write to file to handle multiline
cat > /tmp/changelog.md << 'HEREDOC'
## Docker
```bash
docker pull manfredsteger/polly:${{ steps.version.outputs.version }}
```
## Quick Start
```bash
# Clone and start
git clone https://github.com/manfredsteger/polly.git
cd polly
git checkout v${{ steps.version.outputs.version }}
make setup
```
## Changes
HEREDOC
echo "$CHANGES" >> /tmp/changelog.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Polly v${{ steps.version.outputs.version }}
body_path: /tmp/changelog.md
prerelease: ${{ steps.version.outputs.prerelease }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mirror-gitlab:
name: Mirror to GitLab
runs-on: ubuntu-latest
needs: github-release
if: ${{ secrets.GITLAB_TOKEN != '' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to GitLab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
git remote add gitlab https://oauth2:${GITLAB_TOKEN}@projekte.services.kita.bayern/entwicklung/termine/polly.git 2>/dev/null || true
git push gitlab ${GITHUB_REF} 2>/dev/null || echo "GitLab mirror push skipped (token not set or access denied)"