Unify dimensions GraphQL API across Program V2 and Forms V2 #378
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: frontend | |
on: | |
push: | |
paths: | |
- frontend/** | |
- .github/workflows/frontend.yaml | |
branches: | |
- main | |
pull_request: | |
paths: | |
- frontend/** | |
- .github/workflows/frontend.yaml | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SKAFFOLD_DEFAULT_REPO: ghcr.io/con2 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_PASSWORD }} | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
- id: cache-bin | |
uses: actions/cache@v3 | |
with: | |
path: bin | |
key: ${{ runner.os }}-bin-2 | |
- if: steps.cache-bin.outputs.cache-hit != 'true' | |
run: | | |
mkdir bin | |
curl -Lo bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | |
curl -Lo bin/kubectl https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl | |
chmod +x bin/skaffold bin/kubectl | |
- run: echo "$PWD/bin" >> $GITHUB_PATH | |
- uses: docker/setup-buildx-action@v3 | |
- id: build | |
name: skaffold build | |
run: | | |
# set SKAFFOLD_PUSH to false unless pushing to main | |
if ! [[ "$GITHUB_EVENT_NAME" == 'push' && "$GITHUB_REF" == 'refs/heads/main' ]]; then | |
export SKAFFOLD_PUSH=false | |
fi | |
skaffold build --file-output build.json | |
working-directory: frontend | |
- name: Store build.json artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-json | |
path: frontend/build.json | |
deploy_staging: | |
runs-on: self-hosted | |
needs: build | |
environment: Staging | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: frontend/package-lock.json | |
- id: cache-bin | |
uses: actions/cache@v3 | |
with: | |
path: bin | |
key: ${{ runner.os }}-bin-2 | |
- if: steps.cache-bin.outputs.cache-hit != 'true' | |
run: | | |
mkdir bin | |
curl -Lo bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | |
curl -Lo bin/kubectl https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl | |
chmod +x bin/skaffold bin/kubectl | |
- run: echo "$PWD/bin" >> $GITHUB_PATH | |
- run: npm ci | |
working-directory: frontend | |
- run: npx ts-node manifest.ts | |
working-directory: frontend/kubernetes | |
env: | |
ENV: staging | |
- run: skaffold deploy -n kompassi2-staging -a ../build.json | |
working-directory: frontend | |
deploy_production: | |
runs-on: self-hosted | |
needs: build | |
environment: Production | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: frontend/package-lock.json | |
- id: cache-bin | |
uses: actions/cache@v3 | |
with: | |
path: bin | |
key: ${{ runner.os }}-bin-2 | |
- if: steps.cache-bin.outputs.cache-hit != 'true' | |
run: | | |
mkdir bin | |
curl -Lo bin/skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 | |
curl -Lo bin/kubectl https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl | |
chmod +x bin/skaffold bin/kubectl | |
- run: echo "$PWD/bin" >> $GITHUB_PATH | |
- run: npm ci | |
working-directory: frontend | |
- run: npx ts-node manifest.ts | |
working-directory: frontend/kubernetes | |
env: | |
ENV: production | |
- run: skaffold deploy -n kompassi2-production -a ../build.json | |
working-directory: frontend |