Skip to content

Commit

Permalink
Yarn plugin support (#7)
Browse files Browse the repository at this point in the history
* add support for yarn plugin

Signed-off-by: Vincenzo Scamporlino <[email protected]>
Co-Authored-by: MT Lewis <[email protected]>

* bump node

Signed-off-by: Vincenzo Scamporlino <[email protected]>
Co-Authored-by: MT Lewis <[email protected]>

* force yarn to override the lockfile

* populate releases-yarn-plugin.json

    Signed-off-by: Vincenzo Scamporlino <[email protected]>
    Co-Authored-by: MT Lewis <[email protected]>

* use release version for yarn-plugin diffs

Co-Authored-by: MT Lewis <[email protected]>
Signed-off-by: Vincenzo Scamporlino <[email protected]>

* exclude yarn.lock from diff

Signed-off-by: Vincenzo Scamporlino <[email protected]>

---------

Signed-off-by: Vincenzo Scamporlino <[email protected]>
Co-authored-by: MT Lewis <[email protected]>
  • Loading branch information
vinzscam and mtlewis authored Oct 9, 2024
1 parent 10e8758 commit 6b15404
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
env:
BACKSTAGE_APP_NAME: backstagediffapp
VERSION: ${{ github.event.inputs.version }}
RELEASE_VERSION: ${{ github.event.inputs.releaseVersion }}
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."

Expand All @@ -24,7 +25,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20
- name: Check out release base
uses: actions/checkout@v2
with:
Expand All @@ -50,14 +51,35 @@ jobs:
run: |
SKIP_DIFF="true" && [[ -z "$(git ls-remote --heads origin release/${VERSION})" ]] && SKIP_DIFF="false"
echo "::set-output name=skip_create_diff::${SKIP_DIFF}"
- name: Add release
- name: Create branch for release ${VERSION}
if: steps.check_branch.outputs.skip_create_diff == 'false'
run: |
git checkout -b release/${VERSION}
git add .
git reset $BACKSTAGE_APP_NAME
git commit -m "Release ${VERSION}"
git push origin release/${VERSION}
if: steps.check_branch.outputs.skip_create_diff == 'false'
- id: check_yarn_plugin_branch
name: Check if yarn plugin branch already exists
run: |
SKIP_DIFF="true" && [[ -z "$(git ls-remote --heads origin release/yarn-plugin/${RELEASE_VERSION})" ]] && SKIP_DIFF="false"
echo "::set-output name=skip_create_diff::${SKIP_DIFF}"
- name: Install yarn plugin
run: |
yarn plugin import https://versions.backstage.io/v1/tags/next/yarn-plugin
- name: Run versions:bump to migrate to backstage:^ versions
run: |
npx @backstage/cli@latest versions:bump --release $RELEASE_VERSION
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Create branch for release ${RELEASE_VERSION} with yarn plugin installed
if: steps.check_yarn_plugin_branch.outputs.skip_create_diff == 'false'
run: |
git checkout -b release/yarn-plugin/${RELEASE_VERSION}
git add .
git reset $BACKSTAGE_APP_NAME yarn.lock
git commit -m "Release ${RELEASE_VERSION}"
git push origin release/yarn-plugin/${RELEASE_VERSION}
- run: echo "🍏 This job's status is ${{ job.status }}."
diff:
name: Create new diffs
Expand All @@ -84,9 +106,19 @@ jobs:
if [ -z "$RELEASE_VERSION" ]; then
jq ".\"$NEW_VERSION\" = {}" < releases.json > _releases.json
else
jq ".\"$RELEASE_VERSION\" = { createApp: \"$NEW_VERSION\"}" < releases.json > _releases.json
jq ".\"$RELEASE_VERSION\" = { createApp: \"$NEW_VERSION\" }" < releases.json > _releases.json
fi
mv _releases.json releases.json
- name: Create new diffs for yarn plugin
run: |
for version in $(jq -r 'to_entries |.[] | .key' < releases-yarn-plugin.json); do
echo "Creating yarn-plugin diffs between version $version and $RELEASE_VERSION"
git diff -U1 origin/release/yarn-plugin/$version..origin/release/yarn-plugin/$RELEASE_VERSION > diffs-yarn-plugin/$version..$RELEASE_VERSION.diff
done
- name: Add new version to releases-yarn-plugin.json
run: |
jq ".\"$RELEASE_VERSION\" = { createApp: \"$NEW_VERSION\" }" < releases-yarn-plugin.json > _releases-yarn-plugin.json
mv _releases-yarn-plugin.json releases-yarn-plugin.json
- name: Setup git bot user
run: |
git config user.name "github-actions[bot]"
Expand Down

0 comments on commit 6b15404

Please sign in to comment.