Skip to content

Remove pack prefix of action name (#160) #112

Remove pack prefix of action name (#160)

Remove pack prefix of action name (#160) #112

Workflow file for this run

name: release
on:
push:
branches:
- master
release:
types: # This configuration does not affect the page_build event above
- prereleased
- released
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
frontend:
name: Build frontend
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: '12'
- name: Check out code
uses: actions/checkout@v2
- name: Cache node_modules 📦
uses: actions/cache@v2.1.4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci --prefer-offline --no-audit
working-directory: frontend
- run: npm run lint
working-directory: frontend
- run: npm run generate
working-directory: frontend
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
# Artifact name
name: frontend # optional
# A file, directory or wildcard pattern that describes what to upload
path: frontend/dist
docker:
name: Build and Push
runs-on: ubuntu-latest
needs: frontend
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Download a Build Artifact
uses: actions/download-artifact@v2
with:
# Artifact name
name: frontend # optional
path: frontend/dist
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta-frontend
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push-frontend
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: "frontend"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}