Create WebAssembly project #71
Workflow file for this run
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: Create Docker image | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'src/**' | |
- '.github/**' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'src/**' | |
- '.github/**' | |
env: | |
REGISTRY: ghcr.io | |
OWNER: ${{ github.repository_owner }} | |
# API_IMAGE: openwish-api | |
WEB_IMAGE: openwish-web | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Docker metadata for Web | |
id: meta-web | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.WEB_IMAGE }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=sha,format=short | |
type=ref,event=branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=raw,value={{date 'YYYY'}}{{date 'MM'}},enable={{is_default_branch}} | |
- name: Build and push Web image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./src | |
file: ./src/OpenWish.Web/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta-web.outputs.tags }} | |
labels: ${{ steps.meta-web.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |