API Container #6
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: API Container | |
on: | |
workflow_dispatch | |
env: | |
IMAGE_NAME: ghcr.io/m3nowak/rowerowe_gminy/api | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: What day is it? | |
id: date | |
run: echo "date=$(date +%F)" >> "$GITHUB_OUTPUT" | |
- name: install python + pdm | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3 python3-pip | |
curl -sSL https://pdm-project.org/install-pdm.py | python3 - | |
pdm self add pdm-version | |
- name: pdm install + version | |
id: pdm_install | |
run: | | |
pdm install | |
echo "version=$(pdm version)" >> "$GITHUB_OUTPUT" | |
- name: Install Podman | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y podman | |
- name: Build the Container image | |
run: > | |
podman build . | |
--tag $IMAGE_NAME:${{ steps.pdm_install.outputs.version }} | |
--tag $IMAGE_NAME:${{ steps.pdm_install.outputs.version }}-${{ steps.date.outputs.date }} | |
--tag $IMAGE_NAME:${{ steps.pdm_install.outputs.version }}-${{ github.run_number }} | |
--tag $IMAGE_NAME:latest | |
- name: Push the Container image to ghcr | |
run: | | |
podman login ghcr.io -u ${{ github.repository_owner }} -p ${{ secrets.PACKAGES_TOKEN }} | |
podman push $IMAGE_NAME:${{ steps.pdm_install.outputs.version }} | |
podman push $IMAGE_NAME:${{ steps.pdm_install.outputs.version }}-${{ steps.date.outputs.date }} | |
podman push $IMAGE_NAME:${{ steps.pdm_install.outputs.version }}-${{ github.run_number }} | |
podman push $IMAGE_NAME:latest |