Skip to content

AB#46862: Refactor route filtering logic (#425) (#427) #28

AB#46862: Refactor route filtering logic (#425) (#427)

AB#46862: Refactor route filtering logic (#425) (#427) #28

name: Build and publish Docker Hub prod image
on:
push:
branches:
- 'master'
jobs:
build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.KARTAT_DOCKERHUB_USER }}
password: ${{ secrets.KARTAT_DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: hsldevcom/hsl-map-publisher
- name: Get commit hash
id: commit_hash
run: echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Get image timestamp
id: timestamp
run: echo "timestamp=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Build and push timestamped tag
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: ${{ format('hsldevcom/hsl-map-publisher:prod-{0}-{1}', steps.timestamp.outputs.timestamp, steps.commit_hash.outputs.hash) }}
build-args: |
BUILD_ENV=prod
DIGITRANSIT_APIKEY=${{ secrets.KARTAT_DIGITRANSITAPIKEY_PROD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name == 'push' }}
tags: hsldevcom/hsl-map-publisher:prod
build-args: |
BUILD_ENV=prod
DIGITRANSIT_APIKEY=${{ secrets.KARTAT_DIGITRANSITAPIKEY_PROD }}