release #62
This file contains 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 | |
on: | |
workflow_dispatch: | |
inputs: | |
with_tests: | |
description: 'Run compliance tests' | |
required: false | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
jobs: | |
build-and-test: | |
name: Build and run SIP Connect Compliance Tests | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PAT }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: Build project | |
run: npm run make | |
- name: Check for next release | |
run: | | |
release=$(.scripts/next-release.sh) | |
echo "Next release: $release" | |
echo "RELEASE=$release" >> $GITHUB_ENV | |
- name: Publish packages to NPM | |
if: env.RELEASE != 'none' | |
run: | | |
echo "NPM_TOKEN=${{ secrets.NPM_TOKEN }}" >> $GITHUB_ENV | |
echo "GITHUB_TOKEN=${{ secrets.GH_PAT }}" >> $GITHUB_ENV | |
echo "@routr:registry=https://registry.npmjs.org/" > .npmrc | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc | |
git config --global user.name "GitHub Actions Bot" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git checkout package-lock.json | |
npm run publish | |
- name: Get Lerna version | |
run: | | |
lerna_version=$(node -p "require('./lerna.json').version") | |
echo "LERNA_VERSION=$lerna_version" >> $GITHUB_ENV | |
- name: Create release note | |
if: env.RELEASE != 'none' | |
id: changelog | |
uses: loopwerk/tag-changelog@v1 | |
with: | |
token: ${{ secrets.DEPLOY_KEY }} | |
exclude_types: other,doc,chore | |
config_file: ./.scripts/tag-changelog-config.js | |
- name: Create draft release | |
if: env.RELEASE != 'none' | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEPLOY_KEY }} | |
with: | |
tag_name: v${{ env.LERNA_VERSION }} | |
release_name: Release v${{ env.LERNA_VERSION }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: true | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: routr-build | |
include-hidden-files: true | |
path: | | |
mods | |
.scripts | |
config | |
lerna.json | |
Dockerfile | |
etc/edgeport.yaml | |
!mods/**/node_modules | |
!mods/**/src | |
!mods/**/test | |
!mods/**/dist/*.ts | |
# This step is only executed for workflow_dispatch events with with_tests = true | |
- name: SIP Connect v1.1 Compliance Tests | |
if: github.event.inputs.with_tests == 'true' | |
run: | | |
docker compose -f compose.yaml -f compose.dev.yaml up \ | |
--build --abort-on-container-exit --exit-code-from compliance compliance | |
publish-to-docker-hub: | |
name: Publish to Docker Hub | |
uses: ./.github/workflows/docker-hub-release.yaml | |
secrets: inherit | |
needs: [build-and-test] |