Skip to content

Commit

Permalink
Merge pull request #55 from ONLYOFFICE/feat/actions
Browse files Browse the repository at this point in the history
feat: github actions
  • Loading branch information
LinneyS authored Nov 22, 2023
2 parents 8fb6313 + c38dab8 commit 2b1aeed
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Artifact

on:
pull_request:
types: [opened, reopened]
branches: [main]
workflow_dispatch:

jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Get Info
run: |
echo "id=$(jq -r '.id' plugin.json)" >> $GITHUB_OUTPUT
echo "version=$(jq -r '.version' plugin.json)" >> $GITHUB_OUTPUT
id: info

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18.16.1

- name: Build Plugin
run: |
export NODE_OPTIONS=--openssl-legacy-provider
make dist
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.info.outputs.id }}-${{ steps.info.outputs.version }}
path: dist/${{ steps.info.outputs.id }}-${{ steps.info.outputs.version }}.tar.gz
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches: [master, main]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18.16.1

- name: Get Info
run: |
echo "id=$(jq -r '.id' plugin.json)" >> $GITHUB_OUTPUT
echo "version=$(jq -r '.version' plugin.json)" >> $GITHUB_OUTPUT
id: info

- name: Build Plugin
run: |
export NODE_OPTIONS=--openssl-legacy-provider
make dist
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.info.outputs.version }}" --notes "$(make docs)"
gh release upload "v${{ steps.info.outputs.version }}" dist/${{ steps.info.outputs.id }}-${{ steps.info.outputs.version }}.tar.gz
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ endif
## Ensures NPM dependencies are installed without having to run this all the time.
webapp/node_modules: $(wildcard webapp/package.json)
ifneq ($(HAS_WEBAPP),)
cd webapp && $(NPM) install
cd webapp && yarn install
touch $@
endif

Expand Down Expand Up @@ -275,3 +275,7 @@ endif
# Help documentation à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@cat Makefile build/*.mk | grep -v '\.PHONY' | grep -v '\help:' | grep -B1 -E '^[a-zA-Z0-9_.-]+:.*' | sed -e "s/:.*//" | sed -e "s/^## //" | grep -v '\-\-' | sed '1!G;h;$$!d' | awk 'NR%2{printf "\033[36m%-30s\033[0m",$$0;next;}1' | sort

.PHONY: docs
docs:
@awk '/## [0-9]/{p++} p; /## [0-9]/{if (p > 1) exit}' CHANGELOG.md | awk 'NR>2 {print last} {last=$$0}'

0 comments on commit 2b1aeed

Please sign in to comment.