build: add pants commands for building & pushing dockerfiles #14
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: 'Pipeline' | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
checks: | |
name: 'checks' | |
#if: ${{ github.event_name == 'pull_request'}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: 'checks' | |
uses: ./.github/workflows/templates/checks | |
build: | |
name: 'build' | |
#if: ${{ github.event_name == 'pull_request'}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Initialize Pants | |
uses: pantsbuild/actions/init-pants@main | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache0-py310 | |
named-caches-hash: ${{ hashFiles('lockfiles/*.json', '**/something-else.lock') }} | |
- name: 'docker login' | |
run: docker login -u _json_key -p "$ARTIFACT_SA" europe-west4-docker.pkg.dev | |
env: | |
ARTIFACT_SA: ${{ secrets.GOOGLE_CREDENTIALS }} | |
- name: 'build' | |
run: pants package dags/luchtmeetnet_ingestion | |
- name: 'add tags' | |
run: | | |
docker tag \ | |
europe-west4-docker.pkg.dev/jasperg-dagster/regi-areg-euw4-dagi-prd/luchtmeetnet_ingestion:latest \ | |
europe-west4-docker.pkg.dev/jasperg-dagster/regi-areg-euw4-dagi-prd/luchtmeetnet_ingestion:$(git rev-parse --short HEAD) | |
- name: 'push to gcr' | |
run: | | |
docker push europe-west4-docker.pkg.dev/jasperg-dagster/regi-areg-euw4-dagi-prd/luchtmeetnet_ingestion:latest | |
docker push europe-west4-docker.pkg.dev/jasperg-dagster/regi-areg-euw4-dagi-prd/luchtmeetnet_ingestion:$(git rev-parse --short HEAD) |