Skip to content

Merge pull request #3455 from cal-itp/fix/archiver-tagging #235

Merge pull request #3455 from cal-itp/fix/archiver-tagging

Merge pull request #3455 from cal-itp/fix/archiver-tagging #235

name: Build and push gtfs-rt-archiver-v3 image
on:
push:
branches:
- 'main'
paths:
- '.github/workflows/build-gtfs-rt-archiver-v3-image.yml'
- 'services/gtfs-rt-archiver-v3/**'
pull_request:
paths:
- '.github/workflows/build-gtfs-rt-archiver-v3-image.yml'
- 'services/gtfs-rt-archiver-v3/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
check:
name: Run static checkers
runs-on: ubuntu-latest
env:
CALITP_BUCKET__GTFS_RT_PARSED: gs://some-test-bucket
CALITP_BUCKET__GTFS_RT_VALIDATION: gs://some-test-bucket
GTFS_RT_VALIDATOR_VERSION: v0.0.0
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: curl -sSL https://install.python-poetry.org | python -
- run: cd services/gtfs-rt-archiver-v3 && poetry install && poetry run mypy .
build_push:
name: Package docker image
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v2
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: curl -sSL https://install.python-poetry.org | python -
# from https://forcepush.tech/python-package-ci-cd-with-git-hub-actions
- name: Get image tag from pyproject.toml and commit SHA
run: |
cd services/gtfs-rt-archiver-v3
PROJECT_VERSION=$(poetry version --short)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=${GITHUB_SHA:0:6}" >> $GITHUB_ENV
- uses: docker/build-push-action@v2
with:
context: services/gtfs-rt-archiver-v3
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/${{github.repository}}/gtfs-rt-archiver-v3:${{env.PROJECT_VERSION}}-${{env.GITHUB_SHA_SHORT}}