-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will lint, test, and publish individual plugins.
- Loading branch information
1 parent
f2b82a1
commit deac4f3
Showing
9 changed files
with
177 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish | ||
|
||
# This workflow will publish releases published on GitHub to NPM. | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: The tag to publish (for example "coder/v0.0.0") | ||
type: string | ||
required: true | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: robinraju/release-downloader@v1.9 | ||
with: | ||
tag: ${{ github.event.inputs.tag || github.ref_name }} | ||
fileName: "*.tgz" | ||
- run: yarn publish *.tgz | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Release | ||
|
||
# This workflow will draft a release for a plugin when tagged. | ||
# The tag format is <name>/v<version> without the backstage-plugin- prefix. | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*/v*" | ||
|
||
permissions: | ||
contents: write # For creating releases. | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
split-tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
plugin: ${{ steps.split.outputs.plugin }} | ||
version: ${{ steps.split.outputs.version }} | ||
steps: | ||
- env: | ||
TAG: ${{ github.ref_name }} | ||
id: split | ||
run: | | ||
parts=(${TAG//\/v/ }) | ||
echo "plugin=${parts[0]}" >> $GITHUB_OUTPUT | ||
echo "version=${parts[1]}" >> $GITHUB_OUTPUT | ||
plugin: | ||
needs: split-tag | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: plugins/backstage-plugin-${{ needs.split-tag.outputs.plugin }} | ||
name: ${{ needs.split-tag.outputs.plugin }} v${{ needs.split-tag.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: yarn | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn lint | ||
- run: yarn tsc | ||
- run: yarn test | ||
- run: yarn build | ||
# Version it with the version in the tag and upload it to a draft release. | ||
- run: yarn version --new-version ${{ needs.split-tag.outputs.version }} | ||
- run: yarn pack | ||
- uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: plugins/backstage-plugin-${{ needs.split-tag.outputs.plugin }}/*.tgz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Test | ||
|
||
# This workflow will lint and test a plugin whenever it or CI changes. | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
# Cancel in-progress runs for pull requests when developers push changes. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
jobs: | ||
changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
plugins: ${{ steps.filter.outputs.changes }} | ||
steps: | ||
# Pull requests do not need to check out the code to detect changes | ||
# because the action fetches changed files through the API. | ||
- uses: actions/checkout@v4 | ||
if: github.event_name != 'pull_request' | ||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
filters: | | ||
coder: | ||
- ".github/workflows/build.yaml" | ||
- "plugins/backstage-plugin-coder/**" | ||
plugin: | ||
needs: changes | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
plugin: ${{ fromJSON(needs.changes.outputs.plugins) }} | ||
name: ${{ matrix.plugin }} | ||
defaults: | ||
run: | ||
working-directory: plugins/backstage-plugin-${{ matrix.plugin }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: yarn | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn lint | ||
- run: yarn tsc | ||
- run: yarn test | ||
- run: yarn build | ||
# Version it with the SHA and upload to the run as an artifact in case | ||
# someone needs to download it for testing. | ||
- run: yarn version --new-version "0.0.0-devel+$GITHUB_SHA" | ||
- run: yarn pack | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.plugin }} | ||
path: plugins/backstage-plugin-${{ matrix.plugin }}/*.tgz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18.19.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# We add the tags ourselves and do not commit the version bump; prevent Yarn | ||
# from trying to do so. | ||
version-git-tag false | ||
version-commit-hooks false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
# [Backstage](https://backstage.io) | ||
|
||
This is your newly scaffolded Backstage App, Good Luck! | ||
## Contributing | ||
|
||
To start the app, run: | ||
To start the app: | ||
|
||
```sh | ||
yarn install | ||
yarn dev | ||
``` | ||
|
||
To run an individual plugin: | ||
|
||
```sh | ||
cd plugins/backstage-plugin-$name | ||
yarn install | ||
yarn start | ||
``` | ||
|
||
## Releasing | ||
|
||
To draft a release for a plugin push a tag named `$name/v$version` without the | ||
`backstage-plugin-` prefix. For example: | ||
|
||
```sh | ||
git tag -a coder/v0.0.0 -m "coder v0.0.0" | ||
git push origin coder/v0.0.0 | ||
``` | ||
|
||
This will kick off an action that will create a draft release for the plugin. | ||
Once you have reviewed the release you can publish it and another action will | ||
publish the plugin to NPM. |
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
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
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