DataStreamSummaryBot #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Set up Python environment | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| # Cache the ilo-prism.db artifact do we don't have to fetch it every time | |
| - name: Cache store/ilo-prism.db | |
| uses: actions/cache@v3 | |
| with: | |
| path: store/ilo-prism.db | |
| key: ${{ runner.os }}-ilo-prism-db-${{ github.ref_name }}-${{ github.event.workflow }}-$(date +%Y-%m-%d) | |
| restore-keys: | | |
| ${{ runner.os }}-ilo-prism-db-${{ github.ref_name }}-${{ github.event.workflow }}- | |
| # Install dependencies and run the Python module | |
| - name: Install dependencies and run ilostat module | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| if [ ! -f store/ilo-prism.db ]; then | |
| python -m ilostat.ilostat | |
| else | |
| echo "Using cached store/ilo-prism.db" | |
| fi | |
| # Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Build the Docker image | |
| - name: Build Docker image | |
| run: | | |
| docker build -t ghcr.io/${{ github.repository }}/ilostat-simple-summarizer:latest . | |
| # Push the Docker image to GHCR | |
| - name: Push Docker image | |
| run: | | |
| docker push ghcr.io/${{ github.repository }}/ilostat-simple-summarizer:latest |