Bump the shop-frontend-npm group across 1 directory with 13 updates #91
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: shop-frontend | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- .github/workflows/shop-frontend.yaml | |
- shop-frontend/** | |
pull_request: | |
branches: [ main ] | |
paths: | |
- .github/workflows/shop-frontend.yaml | |
- shop-frontend/** | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
REGISTRY: ghcr.io | |
IMAGE: ghcr.io/${{ github.repository }}/shop-frontend | |
defaults: | |
run: | |
working-directory: ./shop-frontend | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
#- name: Test | |
# run: yarn test | |
- name: Lint | |
run: yarn lint | |
docker: | |
runs-on: ubuntu-latest | |
needs: [build] | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: version | |
run: echo "version=$(date +'%Y%m%d-%H%M%S')-$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT} | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/metadata-action@v5 | |
id: metadata | |
with: | |
images: | | |
${{ env.IMAGE }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=sha | |
type=raw,value=${{ steps.version.outputs.version }} | |
- uses: docker/build-push-action@v6 | |
with: | |
context: ./shop-frontend | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [docker] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_FRONTEND_DEPLOY_APIKEY }} | |
CLUSTER: dev-gcp | |
RESOURCE: shop-frontend/.nais/nais.yaml | |
VARS: shop-frontend/.nais/dev.yaml | |
IMAGE: ${{ env.IMAGE }}:${{ needs.docker.outputs.version }} |