test: updated actions #402
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: Build Docker | |
on: | |
push: | |
branches: | |
- feat/config-secret-integration-develop | |
# - develop | |
# - staging | |
# - main | |
env: | |
IMAGE_NAME: europe-docker.pkg.dev/jumper-g-artifacts/docker-jumper-exchange/jumpex | |
PROJECT_ID: jumper-g-management | |
GCP_REGION: europe-west1 | |
jobs: | |
build-docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # Updated to latest version | |
- 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: Authenticate to Google Cloud | |
id: gcpauth | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: 'access_token' | |
create_credentials_file: true | |
workload_identity_provider: 'projects/800848389157/locations/global/workloadIdentityPools/github/providers/github' | |
service_account: 'artifact-deployer-secret@jumper-g-management.iam.gserviceaccount.com' | |
- name: Login to Artifact Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.gcpauth.outputs.access_token }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 # Updated to latest version | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=branch,prefix=${{ env.UNIQ_ID }}- | |
- name: Access and Verify GCP Secrets | |
id: secrets | |
run: | | |
echo "Fetching secret from jumper-d-dev project..." | |
SECRET_VALUE=$(gcloud secrets versions access latest --secret="jumper-exchange-env" --project="jumper-d-dev") | |
if [ $? -eq 0 ]; then | |
echo "Secret retrieved successfully!" | |
echo "Length of secret: ${#SECRET_VALUE}" | |
echo "SECRET_VALUE=$SECRET_VALUE" >> $GITHUB_ENV | |
else | |
echo "Failed to retrieve secret" | |
exit 1 | |
fi | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.gcpauth.outputs.credentials_file_path }} | |
# - name: Build and push Docker image | |
# uses: docker/build-push-action@v5 # Updated to latest version | |
# with: | |
# context: . | |
# push: true | |
# tags: ${{ steps.meta.outputs.tags }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# build-args: | | |
# NEXT_PUBLIC_LATEST_COMMIT_SHA=${{ github.sha }} | |
# SECRET_VALUE=${{ env.SECRET_VALUE }} |