Skip to content

ci: fix docker release #26

ci: fix docker release

ci: fix docker release #26

Workflow file for this run

name: Release
on:
push:
branches:
- master
tags:
- '*'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/[email protected]
with:
standalone: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'pnpm'
- name: pnpm install
run: pnpm install
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
commit: 'chore: release package(s)'
title: 'Version Packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
publish-docker:
name: Publish Docker Images
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.published == 'true' && contains(github.ref, '@embetty/server')
strategy:
fail-fast: true
matrix:
package: ${{ fromJson(needs.release.outputs.publishedPackages) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: heiseonline/embetty-server
tags: |
type=ref,event=branch
type=semver,pattern={{version}},value=${{ matrix.package.version }}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
${{ github.ref == 'refs/heads/master' && 'type=raw,value=latest' || '' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/arm64/v8,linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}