Skip to content

Update .releaserc

Update .releaserc #139

name: Semantic release
on:
workflow_dispatch:
push:
paths:
- "src/**"
- "dockerfile"
- ".releaserc"
- "package.json"
- "README.md"
- "dockerfile"
branches:
- "main"
- "dev"
env:
GH_TOKEN: ${{ secrets.AUTH_GH }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NEW_RELEASE_PUBLISHED: false
HUSKY: 0
jobs:
build:
runs-on: ubuntu-latest
outputs:
NEW_RELEASE_PUBLISHED: ${{ steps.semantic-release.outputs.new_release_published }}
NEXT_VERSION: ${{ steps.semantic-release.outputs.version }}
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- id: semantic-release
run: npm run semantic-release:ci
docker:
needs: build
runs-on: ubuntu-latest
if: needs.build.outputs.NEW_RELEASE_PUBLISHED
steps:
- env:
NEW_RELEASE_PUBLISHED: ${{ needs.build.outputs.NEW_RELEASE_PUBLISHED }}
NEXT_VERSION: ${{ needs.build.outputs.NEXT_VERSION }}
run: echo "Creating docker release for version $NEXT_VERSION"
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v4.5.0
with:
cosign-release: "v1.13.1"
- name: Setup Docker buildx
uses: docker/setup-buildx-action@0f069ddc17b8eb78586b08a7fe335fd54649e2d3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@06895751d15a223ec091bea144ad5c7f50d228d0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GH_TOKEN }}
- name: Echo Version
run: |
echo "Docker: $NEXT_VERSION"
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=raw,value=latest,enable={{ is_default_branch }}
type=raw,value=${{ needs.build.outputs.NEXT_VERSION }}
type=semver,pattern={{version}},value=${{ needs.build.outputs.NEXT_VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.build.outputs.NEXT_VERSION }}
type=semver,pattern={{major}},value=${{ needs.build.outputs.NEXT_VERSION }}
type=ref,event=branch
#type=sha
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a
with:
context: .
build-args: |
DOCUDIGGER_VERSION=${{ needs.build.outputs.NEXT_VERSION }}
platforms: linux/amd64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max