0.2.2 #2
Workflow file for this run
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: Docker Build on Tag | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up gcloud CLI | |
uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
project_id: genuine-flight-317411 | |
export_default_credentials: true | |
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication | |
- name: Configure Docker | |
run: |- | |
gcloud auth configure-docker us-central1-docker.pkg.dev | |
- name: Verify gcloud configuration | |
run: |- | |
gcloud config get-value project | |
- name: Update package version | |
run: | | |
sed -i 's/__version__ = .*/__version__ = "${{github.ref_name}}"/g' holmes/__init__.py | |
sed -i 's/0.0.0/${{github.ref_name}}/g' helm/holmes/Chart.yaml helm/holmes/values.yaml | |
sed -i 's/0.0.1/${{github.ref_name}}/g' helm/holmes/Chart.yaml | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
tags: us-central1-docker.pkg.dev/genuine-flight-317411/devel/holmes:${{ github.ref_name }} | |
build-args: | | |
BUILDKIT_INLINE_CACHE=1 | |
# Note: this ignores the "Set as latest release" checkbox in the GitHub UI | |
# it isn't possible to check whether that was set or not | |
# so if you do not want to override the "latest" tag, you should mark the release as a prerelease or a draft | |
# for prereleases and drafts we don't tag latest | |
- name: Tag and push Docker image as latest if applicable | |
if: ${{ github.event.release.prerelease == false && github.event.release.draft == false }} | |
run: | | |
docker pull us-central1-docker.pkg.dev/genuine-flight-317411/devel/holmes:${{ github.ref_name }} | |
docker tag us-central1-docker.pkg.dev/genuine-flight-317411/devel/holmes:${{ github.ref_name }} us-central1-docker.pkg.dev/genuine-flight-317411/devel/holmes:latest | |
docker push us-central1-docker.pkg.dev/genuine-flight-317411/devel/holmes:latest | |
- name: Save artifact with helm chart | |
uses: actions/upload-artifact@v2 | |
with: | |
name: helm-chart | |
path: helm/holmes/ | |
- name: Upload helm chart | |
run: | | |
cd helm && ./upload_chart.sh |