wireadmin/.github/workflows/release.yaml

103 lines
3.0 KiB
YAML
Raw Normal View History

2024-04-26 21:36:57 +00:00
name: Release Package
on:
2024-05-29 16:40:18 +00:00
push:
branches:
- canary
2024-01-08 08:59:54 +00:00
2024-05-29 16:40:18 +00:00
concurrency: '${{ github.workflow }}-${{ github.ref }}'
2024-01-08 08:59:54 +00:00
2024-05-29 16:40:18 +00:00
env:
DOCKERHUB_SLUG: shahradel/wireadmin
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
jobs:
2024-04-26 21:36:57 +00:00
release:
2024-05-29 16:40:18 +00:00
if: github.repository == 'wireadmin/wireadmin'
runs-on: ubuntu-latest
2024-05-29 16:40:18 +00:00
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
2024-04-26 21:36:57 +00:00
steps:
2024-05-29 16:40:18 +00:00
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
2024-09-08 19:55:07 +00:00
version: 9
2024-05-29 16:40:18 +00:00
- uses: actions/setup-node@v4
2024-04-26 21:36:57 +00:00
with:
2024-05-29 16:40:18 +00:00
node-version: 18
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
2024-04-26 21:36:57 +00:00
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
commit: 'chore(release): version package'
title: 'chore(release): version package'
2024-05-29 16:40:18 +00:00
publish: pnpm ci:publish
2024-04-26 21:36:57 +00:00
env:
2024-05-29 16:40:18 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2024-05-29 16:40:18 +00:00
build:
name: Build & Publish
2024-04-26 21:36:57 +00:00
runs-on: ubuntu-latest
2024-05-29 16:40:18 +00:00
needs: release
2024-05-29 16:44:44 +00:00
permissions:
packages: write
2024-05-29 16:40:18 +00:00
if: needs.release.outputs.published == 'true'
strategy:
fail-fast: true
matrix:
package: ${{ fromJson(needs.release.outputs.publishedPackages) }}
steps:
2024-05-29 16:40:18 +00:00
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
2024-05-29 16:40:18 +00:00
- uses: docker/setup-qemu-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
2024-05-29 16:40:18 +00:00
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
2024-05-29 16:40:18 +00:00
password: ${{ secrets.GITHUB_TOKEN }}
2024-05-29 16:40:18 +00:00
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
2024-05-29 16:40:18 +00:00
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tags: |
type=semver,pattern={{version}},value=${{ matrix.package.version }}
2024-05-29 16:40:18 +00:00
- name: Build and push
uses: docker/bake-action@v4
with:
2024-05-29 16:40:18 +00:00
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-all
push: true
2024-05-29 16:40:18 +00:00
- name: Check manifest
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
- name: Inspect image
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}