Skip to content

chore(deps): update dependency @types/dockerode to v3.3.28 (#262) #131

chore(deps): update dependency @types/dockerode to v3.3.28 (#262)

chore(deps): update dependency @types/dockerode to v3.3.28 (#262) #131

name: 'Release and publish Workflow'
on:
workflow_dispatch:
inputs:
create_release:
description: 'Create release'
required: true
type: boolean
default: true
publish_packages:
description: 'Publish npm packages'
required: true
type: boolean
default: true
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
outputs:
needs_release: ${{ steps.release_check.outputs.needs_release }}
strategy:
matrix:
node-version: [20.x]
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
steps:
- name: Check of github.event.before
if: ${{ !github.event.inputs.create_release && !github.event.inputs.publish_packages }}
run: if [ '${{ github.event.before }}' = '0000000000000000000000000000000000000000' ]; then echo "::warning title=Missing github.event.before::You are running this CD workflow on a newly created branch. Release won't be created..."; fi
- name: Checkout repository
uses: actions/[email protected]
- name: use node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install --frozen-lockfile
uses: backstage/actions/[email protected]
with:
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
- name: Fetch previous commit for release check
if: ${{ github.event.before != '0000000000000000000000000000000000000000' }}
run: git fetch origin '${{ github.event.before }}'
- name: Check if release
id: release_check
if: ${{ github.event.before != '0000000000000000000000000000000000000000' }}
run: node scripts/check-if-release.js
env:
COMMIT_SHA_BEFORE: '${{ github.event.before }}'
- name: validate config
run: yarn backstage-cli config:check --lax
- name: lint
run: yarn backstage-cli repo lint
- name: type checking and declarations
run: yarn tsc:full
- name: build
run: yarn backstage-cli repo build --all
- name: verify type dependencies
run: yarn lint:type-deps
# A separate release build that is only run for commits that are the result of merging the "Version Packages" PR
# We can't re-use the output from the above step, but we'll have a guaranteed node_modules cache and
# only run the build steps that are necessary for publishing
release:
needs: build
if: needs.build.outputs.needs_release == 'true' || github.event.inputs.create_release || github.event.inputs.publish_packages
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
env:
CI: 'true'
NODE_OPTIONS: --max-old-space-size=4096
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: use node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install --frozen-lockfile
uses: backstage/actions/[email protected]
with:
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
- name: build type declarations
run: yarn tsc:full
- name: build packages
run: yarn backstage-cli repo build
# Publishes current version of packages that are not already present in the registry
- name: publish
if: needs.build.outputs.needs_release == 'true' || github.event.inputs.publish_packages
run: |
yarn config set -H 'npmAuthToken' "${{secrets.NPM_TOKEN}}"
if [ -f ".changeset/pre.json" ]; then
yarn workspaces foreach --all --verbose --no-private npm publish --access public --tolerate-republish --tag next
else
yarn workspaces foreach --all --verbose --no-private npm publish --access public --tolerate-republish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Grabs the version in the root package.json and creates a tag on GitHub
- name: Create a release tag
id: create_tag
if: needs.build.outputs.needs_release == 'true' || github.event.inputs.create_release
run: node scripts/create-release-tag.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Convert the newly created tag into a release with changelog information
- name: Create release on GitHub
if: needs.build.outputs.needs_release == 'true' || github.event.inputs.create_release
run: node scripts/create-github-release.js ${{ steps.create_tag.outputs.tag_name }} 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}