-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Staging Release
- Loading branch information
Showing
15 changed files
with
378 additions
and
97 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,82 @@ | ||
name: Build docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- staging | ||
- main | ||
|
||
env: | ||
IMAGE_NAME: europe-docker.pkg.dev/jumper-g-artifacts/docker-jumper-exchange/jumpex | ||
|
||
jobs: | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
|
||
# id token | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
|
||
steps: | ||
- # check out the repository | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set current date as env variable | ||
run: echo "UNIQ_ID=$(date +'%y%m%d')-${GITHUB_SHA:0:7}" >> $GITHUB_ENV | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
/tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Authenticate to Google Cloud | ||
id: gcpauth | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
create_credentials_file: 'true' | ||
workload_identity_provider: 'projects/800848389157/locations/global/workloadIdentityPools/github/providers/github' | ||
service_account: '[email protected]' | ||
|
||
- # login to gcp | ||
name: login | ||
run: |- | ||
gcloud auth login --brief --cred-file="${{ steps.gcpauth.outputs.credentials_file_path }}" | ||
gcloud auth configure-docker europe-docker.pkg.dev | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=branch,prefix=${{ env.UNIQ_ID }}- | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: | | ||
type=local,src=/tmp/.buildx-cache | ||
cache-to: | | ||
type=local,dest=/tmp/.buildx-cache | ||
build-args: | | ||
ENV_FILE=${{ github.ref_name == 'main' && '.env.production' || github.ref_name == 'develop' && '.env.development' || format('.env.{0}', github.ref_name) }} | ||
ENV_NAME=${{ github.ref_name == 'main' && 'prod' || github.ref_name }} |
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
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
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
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
Oops, something went wrong.