Skip to content

release mockotlpserver 0.6.1 (#491) #5

release mockotlpserver 0.6.1 (#491)

release mockotlpserver 0.6.1 (#491) #5

# Release a tagged version of the '@elastic/mockotlpserver' package.
name: release-mockotlpserver
on:
push:
tags:
- mockotlpserver-v*.*.*
# 'id-token' perm needed for npm publishing with provenance (see
# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow)
permissions:
attestations: write
contents: write
pull-requests: read
id-token: write
jobs:
release:
runs-on: ubuntu-latest
env:
PKGDIR: packages/mockotlpserver
PKGNAME: "@elastic/mockotlpserver"
DOCKER_IMAGE_NAME: ghcr.io/${{ github.repository }}/mockotlpserver
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 'v18.20.4'
registry-url: 'https://registry.npmjs.org'
# Push a Docker image.
- uses: docker/setup-buildx-action@v3
- id: docker-meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
flavor: |
latest=auto
tags: |
# git tag "mockotlpserver-v1.2.3" -> Docker tags "1.2.3", "latest"
type=match,pattern=mockotlpserver-v(\d+\.\d+\.\d+),group=1
labels: |
org.opencontainers.image.vendor=Elastic
org.opencontainers.image.title=mockotlpserver
org.opencontainers.image.description=A mock OTLP server, for dev and testing
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: docker-push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
platforms: linux/amd64,linux/arm64
file: 'packages/mockotlpserver/Dockerfile'
push: true
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
- name: Attest Docker image
uses: actions/attest-build-provenance@c4fbc648846ca6f503a13a2281a5e7b98aa57202 # v2.0.1
with:
subject-name: ${{ env.DOCKER_IMAGE_NAME }}
subject-digest: ${{ steps.docker-push.outputs.digest }}
push-to-registry: true
- run: npm publish
working-directory: ${{ env.PKGDIR }}
env:
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: GitHub release
run: |
npm ci # need top-level devDeps for github-release.sh script
./scripts/github-release.sh "$PKGDIR" "${{ github.ref_name }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Notify in Slack
# Only notify on failure, because on success the published GitHub
# Release will result in a notification from the GitHub Slack app
# (assuming '/github subscribe elastic/elastic-otel-node').
if: ${{ failure() }}
uses: elastic/oblt-actions/slack/notify-result@v1.16.0
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#apm-agent-node"
message: '[${{ github.repository }}] Release `${{ env.PKGNAME }}` *${{ github.ref_name }}*'