Develop #98
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: Release Obsidian plugin | |
on: | |
pull_request_target: | |
types: | |
- closed | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release: | |
if: ${{ github.event.pull_request.merged == true && github.head_ref == 'develop' && github.event.pull_request.author_association == 'OWNER' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print github | |
run: echo '${{ toJson(github) }}' | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- name: Build plugin main.js | |
id: build_plugin | |
run: | | |
git config core.autocrlf false | |
git config core.eol lf | |
npm ci | |
npm run build | |
TAG_NAME=$(node -p "require('./package.json').version") | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
main.js | |
manifest.json | |
styles.css | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.TAG_NAME }} | |
prerelease: false | |
draft: false | |
- name: Create and merge pull request from main to develop | |
run: | | |
gh pr create -B develop -H main --title 'Merge main into develop' --body 'Merge main into develop' | |
gh pr merge main --merge --auto --body 'Merge main into develop' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |