Create and publish release #1
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: Create and publish release | |
on: [workflow_dispatch] | |
permissions: | |
contents: write | |
env: | |
node-version: 18 | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Configure / Setup with Yarn | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version-file: .tool-versions | |
- run: yarn install --immutable | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v37 | |
with: | |
files: | | |
**/*.md | |
**/*.yml | |
**/*.yaml | |
**/*.ts | |
**/*.js | |
**/*.html | |
- name: Prettify code | |
uses: creyD/prettier_action@v4.3 | |
with: | |
prettier_options: >- | |
--check ${{ steps.changed-files.outputs.all_changed_files }} | |
dry: true | |
only_changed: false | |
bump-version: | |
name: Bump version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: 'yarn' | |
- run: git pull | |
- run: yarn | |
- run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- run: yarn bump | |
- run: git push --follow-tags | |
tagged-release: | |
name: Create tagged release | |
needs: [bump-version] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: git pull | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: 'WyriHaximus/github-action-get-previous-tag@v1' | |
- uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: '${{ secrets.GITHUB_TOKEN }}' | |
prerelease: false | |
automatic_release_tag: ${{ steps.previoustag.outputs.tag }} | |
files: 'CHANGELOG.md' | |
frontend-publish: | |
name: Publish plugin frontend | |
runs-on: ubuntu-latest | |
needs: [tagged-release] | |
defaults: | |
run: | |
working-directory: ./plugins/service-health-dashboard | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create yarnrc.yml | |
run: | | |
echo "npmAuthToken: ${{ secrets.NPM_TOKEN }}" >> ~/.yarnrc.yml | |
echo "npmAlwaysAuth: true" >> ~/.yarnrc.yml | |
echo "npmPublishRegistry: https://registry.npmjs.org" >> ~/.yarnrc.yml | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: 'yarn' | |
- run: git pull | |
- run: yarn | |
- run: yarn tsc | |
- run: yarn build | |
- run: yarn npm publish | |
backend-publish: | |
name: Publish plugin backend | |
runs-on: ubuntu-latest | |
needs: [tagged-release] | |
defaults: | |
run: | |
working-directory: ./plugins/service-health-backend | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create yarnrc.yml | |
run: | | |
echo "npmAuthToken: ${{ secrets.NPM_TOKEN }}" >> ~/.yarnrc.yml | |
echo "npmAlwaysAuth: true" >> ~/.yarnrc.yml | |
echo "npmPublishRegistry: https://registry.npmjs.org" >> ~/.yarnrc.yml | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: 'yarn' | |
- run: git pull | |
- run: yarn | |
- run: yarn tsc | |
- run: yarn build | |
- run: yarn npm publish |