feat(stockbot): init #3
This file contains 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: Python Build and Docker Image Build/Push | |
on: | |
push: | |
branches: | |
- main # Trigger on push to the main branch | |
pull_request: | |
branches: | |
- main # Trigger on pull request to the main branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11.2 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.2 | |
cache: 'pip' # caching pip dependencies | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate Token | |
id: generate-token | |
uses: tibdex/[email protected] | |
with: | |
app_id: ${{ secrets.BOT_APP_ID }} | |
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ steps.generate-token.outputs.token }} | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/unusualpseudo/stockbot:latest . | |
- name: Push Docker image | |
run: | | |
docker push ghcr.io/unusualpseudo/stockbot:latest |