|
| 1 | +--- |
| 2 | +name: "Tests" |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + pull_request: |
| 10 | + types: |
| 11 | + - opened |
| 12 | + - reopened |
| 13 | + - synchronize |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + check-if-comment-pr: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + is_comment_pr: ${{ steps.check_pr_title.outputs.is_comment_pr }} |
| 24 | + steps: |
| 25 | + - name: Check if PR is a comment submission |
| 26 | + id: check_pr_title |
| 27 | + # PR başlığı "chore: new comment on" ile başlıyorsa, yorum PR'ı olarak kabul et |
| 28 | + run: | |
| 29 | + if [[ "${{ github.event.pull_request.title }}" == chore:\ new\ comment\ on* ]]; then |
| 30 | + echo "is_comment_pr=true" >> $GITHUB_OUTPUT |
| 31 | + else |
| 32 | + echo "is_comment_pr=false" >> $GITHUB_OUTPUT |
| 33 | + fi |
| 34 | +
|
| 35 | + test-build: |
| 36 | + needs: check-if-comment-pr |
| 37 | + # Eğer bu bir yorum PR'ı ise ve PR açılmışsa test işini çalıştırma |
| 38 | + if: ${{ needs.check-if-comment-pr.outputs.is_comment_pr != 'true' || github.event_name != 'pull_request' }} |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Setup Node.js |
| 45 | + uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: "20" |
| 48 | + cache: "npm" |
| 49 | + |
| 50 | + - name: Install Node.js dependencies |
| 51 | + run: npm ci |
| 52 | + |
| 53 | + - name: Setup Türkçe Locale |
| 54 | + run: | |
| 55 | + # Gerekli paketleri yükle |
| 56 | + sudo apt-get update && sudo apt-get install -y locales tzdata |
| 57 | +
|
| 58 | + # Tüm desteklenen locale'leri listele ve Türkçe'yi etkinleştir |
| 59 | + sudo sed -i 's/# tr_TR.UTF-8 UTF-8/tr_TR.UTF-8 UTF-8/' /etc/locale.gen |
| 60 | + sudo dpkg-reconfigure --frontend=noninteractive locales |
| 61 | +
|
| 62 | + # Zaman dilimini ayarla |
| 63 | + sudo timedatectl set-timezone Europe/Istanbul |
| 64 | +
|
| 65 | + # Sistem genelinde locale ayarla |
| 66 | + sudo update-locale LANG=tr_TR.UTF-8 LC_ALL=tr_TR.UTF-8 |
| 67 | +
|
| 68 | + # Mevcut kabuk için locale ayarla |
| 69 | + export LANG=tr_TR.UTF-8 |
| 70 | + export LC_ALL=tr_TR.UTF-8 |
| 71 | + export TZ=Europe/Istanbul |
| 72 | +
|
| 73 | + # Oluşturulan locale'leri göster |
| 74 | + echo "Oluşturulan locale'ler:" |
| 75 | + locale -a | grep tr_TR |
| 76 | +
|
| 77 | + echo "Tarih ayarları:" |
| 78 | + date |
| 79 | +
|
| 80 | + echo "Locale ayarları:" |
| 81 | + locale |
| 82 | +
|
| 83 | + - name: Setup Python, uv, and the package |
| 84 | + uses: ./.github/actions/setup_python_env |
| 85 | + env: |
| 86 | + LANG: tr_TR.UTF-8 |
| 87 | + LC_ALL: tr_TR.UTF-8 |
| 88 | + TZ: Europe/Istanbul |
| 89 | + |
| 90 | + - name: Create .nojekyll file |
| 91 | + run: touch .nojekyll |
| 92 | + |
| 93 | + - name: Build the site |
| 94 | + env: |
| 95 | + NODE_ENV: production |
| 96 | + LANG: tr_TR.UTF-8 |
| 97 | + LC_ALL: tr_TR.UTF-8 |
| 98 | + TZ: Europe/Istanbul |
| 99 | + run: | |
| 100 | + # Site inşa sürecini başlat |
| 101 | + uv run duty publish |
| 102 | +
|
| 103 | + - name: Confirm files were created |
| 104 | + run: | |
| 105 | + ls -al output |
| 106 | + if [ ! -e "output/index.html" ]; then |
| 107 | + echo "output/index.html not found" |
| 108 | + exit 1 |
| 109 | + fi |
| 110 | +
|
| 111 | + - name: Deploy to GitHub Pages |
| 112 | + if: github.ref == 'refs/heads/main' |
| 113 | + uses: peaceiris/actions-gh-pages@v4 |
| 114 | + with: |
| 115 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 116 | + publish_dir: ./output |
| 117 | + publish_branch: gh-pages |
| 118 | + cname: yuceltoluyag.github.io |
0 commit comments