Skip to content

Commit

Permalink
Merge pull request #205 from redhatrises/mp-docker
Browse files Browse the repository at this point in the history
feat: update release run to build and push to gcr.io
  • Loading branch information
redhatrises authored Jan 8, 2025
2 parents 49e5598 + f4c9a88 commit 8e349af
Showing 1 changed file with 127 additions and 18 deletions.
145 changes: 127 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,137 @@
name: Publish Python Package
name: Release

on:
release:
types: [created]

env:
IMAGE_REGISTRY: gcr.io
IMAGE_NAME: gcr.io/crowdstrike-public/falcon-integration-gateway
DEPLOYER: gcr.io/crowdstrike-public/falcon-integration-gateway/deployer

jobs:
deploy:
python-package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PACKAGE_API_ID }}
TWINE_PASSWORD: ${{ secrets.PACKAGE_API_SECRET }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
container:
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PACKAGE_API_ID }}
TWINE_PASSWORD: ${{ secrets.PACKAGE_API_SECRET }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Checkout
uses: actions/checkout@v4

- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
access_token_lifetime: 600s

- name: Login to gcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ steps.auth.outputs.access_token }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=match,pattern=\d.\d
type=match,pattern=\d.\d.\d
annotations: ${{ secrets.SERVICE_ANNOTATION }}

- name: Build and push
uses: docker/build-push-action@v6
with:
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: false
sbom: false
push: true

deployer:
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"

steps:
- name: Checkout
uses: actions/checkout@v4

- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
token_format: access_token
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
access_token_lifetime: 600s

- name: Login to gcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ steps.auth.outputs.access_token }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Pull latest onbuild image
run: |
docker pull gcr.io/cloud-marketplace-tools/k8s/deployer_helm/onbuild
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DEPLOYER }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=match,pattern=\d.\d
type=match,pattern=\d.\d.\d
annotations: ${{ secrets.SERVICE_ANNOTATION }}

- name: Build and push
uses: docker/build-push-action@v6
with:
context: docs/listings/gke/deployer
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: false
sbom: false
push: true

0 comments on commit 8e349af

Please sign in to comment.