Merge pull request #125 from octet-stream/test/browser-mode #71
This file contains hidden or 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: Release | |
concurrency: ${{github.workflow}}-${{github.ref}} | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 15 | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch whole history | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup pnpm | |
id: pnpm-install | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{steps.pnpm-cache.outputs.STORE_PATH}} | |
key: ${{runner.os}}-pnpm-store-${{hashFiles('**/pnpm-lock.yaml')}} | |
restore-keys: | | |
${{runner.os}}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Changesets release | |
id: changesets | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
uses: changesets/action@v1 | |
with: | |
title: Next release | |
commit: Bump version | |
publish: pnpm changeset tag | |
version: pnpm changeset version | |
outputs: | |
published: ${{steps.changesets.outputs.published}} | |
packages: ${{steps.changesets.outputs.publishedPackages}} | |
publish: | |
name: Publish Docker image | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 15 | |
needs: release | |
if: needs.release.outputs.published == 'true' | |
permissions: | |
contents: read | |
packages: write | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
strategy: | |
fail-fast: true | |
matrix: | |
package: ${{fromJson(needs.release.outputs.packages)}} | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Image metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{env.DOCKER_REGISTRY}}/${{github.repository}} | |
tags: | | |
type=semver,pattern={{major}},value=${{matrix.package.version}} | |
type=semver,pattern={{major}}.{{minor}},value=${{matrix.package.version}} | |
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{matrix.package.version}} | |
type=semver,pattern={{version}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{env.DOCKER_REGISTRY}} | |
username: ${{github.repository_owner}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
platforms: ${{matrix.platform}} | |
tags: ${{steps.meta.outputs.tags}} | |
labels: ${{steps.meta.outputs.labels}} |