ci: add release please #190
Workflow file for this run
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
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- release | |
jobs: | |
tests: | |
uses: ./.github/workflows/tests.yaml | |
integration-tests: | |
uses: ./.github/workflows/integration-tests.yaml | |
#publish-integration-tests-report: | |
# needs: integration-tests | |
# if: ${{ ! cancelled() }} | |
# uses: ./.github/workflows/publish-integration-tests-report.yaml | |
# with: | |
# dmss_version: ${{ needs.integration-tests.outputs.dmss_version }} | |
# dm_cli_version: ${{ needs.integration-tests.outputs.dm_cli_version }} | |
# job_version: ${{ needs.integration-tests.outputs.job_version }} | |
release-please: | |
needs: tests | |
uses: ./.github/workflows/create-release-pr.yaml | |
publish-packages: | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: [dm-core, dm-core-plugins] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Check if new version | |
id: check-version | |
run: | | |
echo "NEW_VERSION=false" >> $GITHUB_OUTPUT | |
cd packages/${{ matrix.package }} | |
PACKAGE_VERSION=$(cat package.json | jq '.["version"]' | tr -d '"') | |
PACKAGE_NAME=$(cat package.json | jq '.["name"]' | tr -d '"') | |
VERSION_EXISTS=$(curl --HEAD --output /dev/null --silent -w "%{http_code}" https://registry.npmjs.org/$PACKAGE_NAME/$PACKAGE_VERSION) | |
if [[ $VERSION_EXISTS == 404 ]]; then | |
echo "NEW_VERSION=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Create package distribution and publish | |
if: steps.check-version.outputs.NEW_VERSION == 'true' | |
run: | | |
yarn install | |
yarn build:packages | |
yarn workspace @development-framework/dm-core publish --access public | |
yarn workspace @development-framework/dm-core-plugins publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |