Files
ermnvldmr.com/.github/workflows/release-semantic-dispatch.yml
T

143 lines
4.1 KiB
YAML

name: release/semantic-dispatch
on:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true
jobs:
setup:
name: Setup stage
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache-pnpm-store.outputs.cache-hit }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Cache pnpm store
id: cache-pnpm-store
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
release:
runs-on: ubuntu-latest
needs: setup
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
packages: write
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Stage
run: pnpm build
- name: Build Storybook
run: pnpm build-storybook
- name: Release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec semantic-release
docker:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.new_release_published == 'true'
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Astro image
id: meta-astro
uses: docker/metadata-action@v5
with:
images: ghcr.io/deytenit/www.ermnvldmr.com
tags: |
type=raw,value=${{ needs.release.outputs.new_release_version }}
type=raw,value={{major}}.{{minor}},enable={{is_default_branch}}
type=raw,value={{major}},enable={{is_default_branch}}
type=raw,value=latest
type=sha,prefix={{branch}}-
- name: Extract metadata for Storybook image
id: meta-storybook
uses: docker/metadata-action@v5
with:
images: ghcr.io/deytenit/www.ermnvldmr.com/storybook
tags: |
type=raw,value=${{ needs.release.outputs.new_release_version }}
type=raw,value={{major}}.{{minor}},enable={{is_default_branch}}
type=raw,value={{major}},enable={{is_default_branch}}
type=raw,value=latest
type=sha,prefix={{branch}}-
- name: Build and push Astro image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/astro/Dockerfile
push: true
tags: ${{ steps.meta-astro.outputs.tags }}
labels: ${{ steps.meta-astro.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Build and push Storybook image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/storybook/Dockerfile
push: true
tags: ${{ steps.meta-storybook.outputs.tags }}
labels: ${{ steps.meta-storybook.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64