Skip to content

Merge pull request #47 from weaveVM/paradigmxyz-main-3 #40

Merge pull request #47 from weaveVM/paradigmxyz-main-3

Merge pull request #47 from weaveVM/paradigmxyz-main-3 #40

Workflow file for this run

name: Google Artifact Registry
on:
push:
branches:
- main
- dev
tags:
- '*'
jobs:
docker-release:
name: Tagged Docker release to Google Artifact Registry
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v2
- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
token_format: access_token
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
access_token_lifetime: 300s
- name: Configure container registry
run: gcloud auth configure-docker us-east1-docker.pkg.dev
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Artifact Registry
uses: docker/login-action@v3
with:
registry: us-east1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Get tag
id: get-tag
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
- name: Set Docker Tag
id: tag
run: |
if [[ "${GITHUB_REF}" == refs/heads/main ]]; then
tag="latest"
elif [[ "${GITHUB_REF}" == refs/heads/dev ]]; then
tag="nightly"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
tag=${GITHUB_REF#refs/tags/}
else
tag=${GITHUB_REF#refs/heads/}
fi
echo "::set-output name=tag::${tag}"
echo "Docker tag: ${tag}"
- name: Test Docker
run: |-
docker build . -t wevm:local
mkdir -m 777 .testnet
cd .testnet
git clone https://github.com/weaveVM/wvm-docker-testnet.git .
echo "${{ secrets.GCP_CREDENTIALS_JSON }}" > ./execution/key.json
docker compose up -d
npm i
SIGNER_KEY=${{ secrets.TEST_SIGNER_KEY }} node test.js
docker compose down
cd .. && sudo rm -rf .testnet
- name: Build and Push Container
run: |-
docker build . -t wevm
docker tag wevm us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.get-tag.outputs.short_ref }}
docker tag wevm us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }}
docker push "us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.get-tag.outputs.short_ref }}"
docker push "us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }}"