|
| 1 | +name: "06-05 - Package Pogoda Info Python" |
| 2 | +run-name: 06-05 - Package Python Pogoda dla ${{ inputs.city }} |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + city: |
| 8 | + description: "City to get weather info for" |
| 9 | + type: string |
| 10 | + default: "Warsaw" |
| 11 | + release_tag: |
| 12 | + description: "Tag / wersja releasu (np. v1.0.0)" |
| 13 | + type: string |
| 14 | + default: "v16.03.2026" |
| 15 | + |
| 16 | +# <<< DODAJ TO >>> |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | +# <<< KONIEC DODATKU >>> |
| 20 | + |
| 21 | +env: |
| 22 | + # Lepiej to przenieść do secrets i używać secrets.MY_KLUCZYK, |
| 23 | + # ale zostawiam jak u Ciebie, żeby było czytelnie. |
| 24 | + MY_KLUCZYK: '7cff9972d5c98a9a47ddf6a59cb34d8e' |
| 25 | + |
| 26 | +jobs: |
| 27 | + pogoda-info: |
| 28 | + name: Pobierz informacje o pogodzie + build binarki |
| 29 | + runs-on: ubuntu-latest |
| 30 | + defaults: |
| 31 | + run: |
| 32 | + shell: bash |
| 33 | + working-directory: ./CWICZENIA/06-context/pogoda_python |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Setup Python |
| 40 | + uses: actions/setup-python@v5 |
| 41 | + with: |
| 42 | + python-version: "3.12" |
| 43 | + |
| 44 | + - name: Install build dependencies |
| 45 | + run: | |
| 46 | + python -m pip install --upgrade pip |
| 47 | + pip install pyinstaller |
| 48 | +
|
| 49 | + - name: Build binary with PyInstaller |
| 50 | + run: | |
| 51 | + # Zbuduje binarkę: ./dist/pogoda |
| 52 | + pyinstaller --onefile start.py --name pogoda |
| 53 | +
|
| 54 | + - name: (Opcjonalnie) Uruchom binarkę i dodaj wynik do podsumowania |
| 55 | + run: | |
| 56 | + ./dist/pogoda "${{ inputs.city }}" "${{ env.MY_KLUCZYK }}" >> "$GITHUB_STEP_SUMMARY" |
| 57 | +
|
| 58 | + - name: Upload binary as artifact (dla wygody) |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: pogoda-linux-amd64 |
| 62 | + path: ./CWICZENIA/06-context/pogoda_python/dist/pogoda |
| 63 | + |
| 64 | + - name: Create GitHub Release and upload binary |
| 65 | + uses: softprops/action-gh-release@v2 |
| 66 | + with: |
| 67 | + tag_name: ${{ inputs.release_tag }} |
| 68 | + name: "Pogoda binary ${{ inputs.release_tag }}" |
| 69 | + draft: false |
| 70 | + prerelease: false |
| 71 | + files: | |
| 72 | + ./CWICZENIA/06-context/pogoda_python/dist/pogoda |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments