Skip to content

Merge pull request #11 from CloudCannon/more-updates-for-decoupled #8

Merge pull request #11 from CloudCannon/more-updates-for-decoupled

Merge pull request #11 from CloudCannon/more-updates-for-decoupled #8

Workflow file for this run

name: Release
on:
push:
tags:
- v*
jobs:
test:
runs-on: ubuntu-24.04
steps:
- name: Clone
uses: actions/checkout@v3
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Unit Test
run: npm run test
publish-github-release:
name: Publish to GitHub
runs-on: ubuntu-24.04
needs: test
steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.CC_OSS_BOT_ID }}
application_private_key: ${{ secrets.CC_OSS_BOT_PEM }}
- name: Swap to main
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0 # Full fetch
token: ${{ steps.get_workflow_token.outputs.token }}
- name: Get Version
run: |
GIT_VERSION=$(node ./.backstage/get_tagged_version.cjs)
echo GIT_VERSION="$GIT_VERSION" >> $GITHUB_ENV
- name: Get Release Tag
run: |
NPM_TAG=$(node ./.backstage/get_npm_tag.cjs)
echo NPM_TAG="$NPM_TAG" >> $GITHUB_ENV
- name: Stable Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') && env.NPM_TAG == 'latest'
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
- name: Prerelease
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') && env.NPM_TAG != 'latest'
with:
prerelease: true
env:
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
publish-npm-release:
runs-on: ubuntu-24.04
needs: publish-github-release
steps:
- name: Clone
uses: actions/checkout@v3
- name: Get Version
run: |
GIT_VERSION=$(node ./.backstage/get_tagged_version.cjs)
echo GIT_VERSION="$GIT_VERSION" >> $GITHUB_ENV
- name: Get Release Tag
run: |
NPM_TAG=$(node ./.backstage/get_npm_tag.cjs)
echo NPM_TAG="$NPM_TAG" >> $GITHUB_ENV
- name: Prepare package
run: |
npm --no-git-tag-version version $GIT_VERSION
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Publish internal
uses: JS-DevTools/npm-publish@v3
with:
tag: ${{ env.NPM_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
registry: "https://npm.pkg.github.com"
- name: Publish external
uses: JS-DevTools/npm-publish@v3
with:
tag: ${{ env.NPM_TAG }}
token: ${{ secrets.NPM_TOKEN }}
access: public