Merge pull request #64 from weaveVM/fix-graphql-gateway #59
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: 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: Build | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
tags: wevm:local,us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.get-tag.outputs.short_ref }},us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }} | |
cache-from: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }} | |
cache-to: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }},mode=max | |
- name: Test Docker | |
run: |- | |
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 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: wevm:local,us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.get-tag.outputs.short_ref }},us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }} | |
cache-from: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }} | |
cache-to: type=registry,ref=us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }},mode=max |