-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: build and push docker image using github actions (#154)
- Loading branch information
1 parent
ec431ff
commit 3913191
Showing
2 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "build-and-push" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
PROD_REGISTRY: "us-docker.pkg.dev/grafanalabs-global/docker-influx2cortex-prod" | ||
DEV_REGISTRY: "us-docker.pkg.dev/grafanalabs-dev/docker-influx2cortex-dev" | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Generate Tags | ||
run: | | ||
bash scripts/generate-tags.sh > .tag | ||
echo "DOCKER_TAG=$(cat .tag)" >> $GITHUB_ENV | ||
echo "$DOCKER_TAG" | ||
- name: Build And Push | ||
uses: grafana/shared-workflows/actions/push-to-gar-docker@main | ||
with: | ||
push: true | ||
# If we are building main, push to prod and add the 'latest' tag. | ||
registry: "${{ github.ref_name == 'main' && env.PROD_REGISTRY || env.DEV_REGISTRY }}" | ||
tags: |- | ||
${{ env.DOCKER_TAG }} | ||
type=raw,value=latest,enable=${{ github.ref_name == 'main' }} | ||
context: "." | ||
image_name: "influx2cortex" | ||
environment: "${{ github.ref_name == 'main' && 'prod' || 'dev' }}" |
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