Skip to content

add public dir for web #70

add public dir for web

add public dir for web #70

Workflow file for this run

name: push
on:
push:
branches: [ main ]
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Test backend
run: cd formulagraphql && go test -v ./...
deploy-frontend:
runs-on: ubuntu-latest
needs: [ unit-test ]
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: wasm32-unknown-unknown
- uses: cargo-bins/cargo-binstall@main
- uses: Swatinem/rust-cache@v1
- name: Install CLI
run: cargo binstall --no-confirm dioxus-cli --locked --force
- uses: actions/checkout@v2
- name: Build
run: cd web && dx build --release
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.3
with:
branch: gh-pages
folder: web/site
target-folder: .
clean: false
build-graphql:
needs: [ unit-test ]
runs-on: ubuntu-latest #run this workflow on ubuntu instance
permissions: #make sure we add permission to read and write packages
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4 #checkouts your repo, so this workflow can access it
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v5
with:
context: ./formulagraphql
tags: formulagraphql:latest
outputs: type=docker,dest=/tmp/formulagraphql.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: formulagraphql
path: /tmp/formulagraphql.tar
push-graphql-to-ghcr:
needs: [ build-graphql ]
runs-on: ubuntu-latest #run this workflow on ubuntu instance
permissions: #make sure we add permission to read the package
contents: read
steps:
- name: Log in to GHCR
env:
REGISTRY: ghcr.io #create env called REGISTRY
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }} #parse REGISTRY env value to here. Make sure it is correctly stating ghcr.io
username: ${{ github.actor }} #this will be our github account
password: ${{ secrets.CR_PAT }} #parse the value of repository secret called CR_PAT that we have created earlier
- name: Extract metadata (tags, labels) for Docker GHCR
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} #create ghcr image format within as id called meta
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: formulagraphql
path: /tmp
- name: Push image
env:
IMAGE_NAME: ${{ github.repository }}
run: |
docker load --input /tmp/formulagraphql.tar
docker tag formulagraphql:latest ghcr.io/$IMAGE_NAME:latest
docker push ghcr.io/$IMAGE_NAME:latest
push-graphql-to-gcr:
needs: [ build-graphql ]
runs-on: ubuntu-latest #run this workflow on ubuntu instance
permissions: #make sure we add permission to read the package
contents: read
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: formulagraphql
path: /tmp
- name: Load image
run: |
docker load --input /tmp/formulagraphql.tar
- name: Login to GCR
env:
PROJECT_ID: f1graph
uses: google-github-actions/setup-gcloud@v0.3.0 #checkouts GCR repo, so this workflow can access it
with:
service_account_key: ${{ secrets.GOOGLE_CREDENTIALS }} #parse the value of repository secret called SERVICE_ACCOUNT_KEY that we have created earlier
project_id: ${{ env.PROJECT_ID }} #parse the value of env called PROJECT_ID
export_default_credentials: true
- name: Configure Docker Client
run: |-
gcloud auth configure-docker --quiet
- name: Push Docker Image to Container Registry GCR
env:
IMAGE_NAME: formulagraphql
PROJECT_ID: f1graph
#tag docker image to gcr image format then push to gcr
run: |-
docker tag $IMAGE_NAME:latest gcr.io/$PROJECT_ID/$IMAGE_NAME:latest
docker push gcr.io/$PROJECT_ID/$IMAGE_NAME:latest