This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
build-plugin #46
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: build-plugin | |
on: | |
workflow_dispatch: | |
inputs: | |
sha_short: | |
description: 'sha_short' | |
required: true | |
new_tag: | |
description: 'new_tag' | |
required: true | |
new_tag_short: | |
description: 'new_tag_short' | |
required: true | |
name: | |
description: 'name' | |
required: true | |
sha: | |
description: "sha" | |
required: true | |
repository_dispatch: | |
types: [build-server] | |
jobs: | |
ci-plugin: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: plugin | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- uses: actions/checkout@v3 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install | |
run: yarn install | |
- name: Lint | |
run: yarn run lint | |
- name: Test | |
run: yarn test | |
- name: Build | |
run: yarn build:plugin | |
- name: Pack | |
run: cd dist && mv plugin plateau-plugin && zip -r plateau-plugin.zip plateau-plugin | |
- name: Save artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plateau-plugin | |
path: plugin/dist/plateau-plugin.zip | |
release-nightly: | |
name: Release nightly/rc | |
runs-on: ubuntu-latest | |
needs: [ci-plugin] | |
if: ${{ github.event.inputs.name != 'blank' }} | |
env: | |
ARTIFACT: plateau-plugin_${{ github.event.inputs.name }}.zip | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: plateau-plugin | |
- name: Rename artifact | |
run: mv plateau-plugin.zip $ARTIFACT | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: ${{ env.ARTIFACT }} | |
artifactContentType: application/zip | |
commit: ${{ github.event.inputs.sha }} | |
name: ${{ github.event.inputs.name }} | |
tag: ${{ github.event.inputs.name }} | |
body: ${{ github.event.inputs.sha }} | |
prerelease: true | |
release: | |
name: Release version zip | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.new_tag != 'blank' }} | |
env: | |
ARTIFACT: plateau-plugin_${{ github.event.inputs.name }} | |
steps: | |
- name: Fetch plateau-plugin release | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
version: tags/rc | |
file: plateau-plugin_rc.zip | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Rename artifact | |
run: mv plateau-plugin_rc.zip $ARTIFACT | |
- name: Download latest changelog | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: release.yml | |
name: changelog-${{ github.event.inputs.new_tag }} | |
- name: Create GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: ${{ env.ARTIFACT }} | |
artifactContentType: application/zip | |
commit: ${{ github.event.inputs.sha }} | |
name: ${{ github.event.inputs.new_tag }} | |
tag: ${{ github.event.inputs.new_tag }} | |
bodyFile: CHANGELOG_latest.md |