Merge remote-tracking branch 'origin/main' into release-3.0.0 #10
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: Prerelease | |
on: | |
push: | |
branches: | |
# Target release-x.x branches | |
- 'release-*' | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
prerelease: | |
name: Changesets Prerelease | |
# Prevents changesets action from creating a PR on forks | |
if: github.repository == 'siemens/ix' | |
runs-on: ubuntu-latest | |
# Permissions necessary for Changesets to push a new branch and open PRs | |
# (for automated Version Packages PRs), and request the JWT for provenance. | |
# More info: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write | |
steps: | |
# Check out the repository, using the Github Actions Bot app's token so | |
# that we can push later. | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/workflows/actions/turbo | |
- name: Check for pre.json file existence | |
id: check_files | |
uses: andstor/[email protected] | |
with: | |
files: '.changeset/pre.json' | |
- name: Enter prerelease mode (alpha by default) | |
# If .changeset/pre.json does not exist and we did not recently exit | |
# prerelease mode, enter prerelease mode with tag alpha | |
if: steps.check_files.outputs.files_exists == 'false' && !contains(github.event.head_commit.message, 'Exit prerelease') | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
pnpm changeset pre enter alpha | |
git add -A | |
git commit -m 'Enter prerelease mode' | |
git push | |
- name: Get prerelease changesets | |
id: prerelease-changesets | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: '.changeset/pre.json' | |
prop_path: 'changesets' | |
- name: Create prerelease PR | |
# Only attempt to create a PR if: | |
# 1. .changeset/pre.json exists | |
# 2. we are not actively publishing after merging a Version Packages PR | |
# 3. AND we have prerelease changesets to publish (otherwise it errors) | |
if: steps.check_files.outputs.files_exists == 'true' && !startsWith(github.event.head_commit.message, 'Version Packages') | |
uses: changesets/action@v1 | |
with: | |
version: pnpm ci:version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm + GitHub | |
id: changesets | |
# Only publish if we're still in pre mode and the last commit was | |
# from an automatically created Version Packages PR | |
if: steps.check_files.outputs.files_exists == 'true' && startsWith(github.event.head_commit.message, 'Version Packages') | |
uses: changesets/action@v1 | |
with: | |
version: echo "This step should never version" | |
publish: pnpm ci:publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |